lunacy (n.)
1540s, "condition of being a lunatic," formed irregularly in English from lunatic (q.v.) + -cy. Originally in reference to intermittent periods of insanity, such as were believed to be triggered by the moon's cycle. The Old English equivalent was monaðseocnes "month-sickness." In later legal use, any unsoundness of mind sufficient to render one incapable of civil transactions or management of one's affairs. Weakened figurative sense "act of madness or folly" is from 1580s.