Brewer's: De Lunatico Inquirendo
(Latin). A writ issued to inquire into the state of a person's mind, whether it is sound or not. If not of sound mind, the person is called non compos, and is committed to proper guardians.
Source: Dictionary of Phrase and Fable, E. Cobham Brewer, 1894