“The sun shall not smite thee by day, nor the moon by night,” said the Hebrew psalmist.
And from early Greek and Roman times, Selene of the Greeks and Luna of the Romans, goddesses of the moon, were also believed to be capable of affecting the brains of mortals.
Those, especially, who slept with head exposed to the light of the moon would become selenobletos or lunatikos, maddened by Selene or, in Rome, by Luna.
No one knows the age of the superstition; it was held also by the ancient Egyptians.