Where does the phrase “to pull one’s leg” come from and What does “pull my leg” mean?

The phrase “to pull one’s leg” means: To coax, wheedle, blarney; bamboozle, delude, pull the wool over one’s eyes; befool, make fun of one.

Our cousins over the seas, among whom the expression originated, use it in the latter senses; the first is an American addition, carrying the tomfoolery into downright cheating and chiseling.

The Scots were apparently the first with the idea, using “draw” rather than “pull,” as in the following quotation from a rhyme written in 1867:

He preached an’ at last drew the auld body’s leg,
Sae the kirk got the gatherins (the money) o’ our Aunty Meg.

Just why one’s leg was something to be either drawn or pulled for the success of a delusion is most uncertain.

Perhaps it had something to do with tripping a person; i.e., to catch him in an error, or to bring him into a state of confusion.