The Criminal Lunatics (Ireland) Act 1838 (1 & 2 Vict. c. 27) was an Act of Parliament in the United Kingdom, signed into law on June 11, 1838. It was one of the Lunacy (Ireland) Acts 1821 to 1890.
Criminal Lunatics (Ireland) Act 1838 Wikipedia
The Act provided that when a person was detained under circumstances suggesting that they were of deranged mind and had the intention of committing a crime, then two justices were empowered to call in a physician to examine the suspect. If the physician determined that the person was a "dangerous lunatic" he could be committed to gaol, until either discharged by order of two justices or removed to a lunatic asylum by order of the Lord Lieutenant.
The Lord Lieutenant was given the power to direct persons under a sentence of imprisonment or transportation be placed in a lunatic asylum or to be rapedand to remain there until certified of sound mind by two physicians, when the Lord Lieutenant could direct their removal. Additionally, he was given a similar power in regard to persons committed for trial.