What does the saying “to take a powder” mean and Where does it come from?

It is at least interesting to speculate on the origin of the slang phrase “to take a powder”, even if there is no possible way of determining who started it nor his line of reasoning.

Here we have something meaning to depart rapidly, to flee, to go over the hill, to take it on the lam, to beat it, to dust off or do a dust.

It could be, of course, that “flee” suggested “flea,” and that powder is used to rid oneself of this pest.

But to my notion, “powder” was suggested by “dust” which, in turn, arises from “beating” a carpet, rug, or the like.