Where Did 'Counting Sheep' Originate?

It is so cliché, I even saw recently it in the rather old movie The Wizard of Oz. Someone says they are having a problem sleeping. So some other character in the movie, etc. says “so why don’t you try counting sheep?”. It is a very old cliché. But where?/who? did it originate with?

Thank you in advance to all who reply :slight_smile:

to quote Evan Morris, from his excellent wordsite.

http://www.word-detective.com/112402.html#countingsheep

You don’t have to actually count sheep to settle your thinking down, just counting does it. Especially counting backwords.

Scotland.

Oh, I thought you said courting sheep. Never mind.

Courting sheep was practiced in the Holy Land long before there were agrarian societies in Scotland.