Article 40.4 provides:
1° No citizen shall be deprived of his personal liberty save in accordance with law.
2° Upon complaint being made by or on behalf of any person to the High Court or any judge thereof alleging that such person is being unlawfully detained, the High Court and any and every judge thereof to whom such complaint is made shall forthwith enquire into the said complaint and may order the person in whose custody such person is detained to produce the body of such person before the High Court on a named day and to certify in writing the grounds of his detention, and the High Court shall, upon the body of such person being produced before that Court and after giving the person in whose custody he is detained an opportunity of justifying the detention, order the release of such person from such detention unless satisfied that he is being detained in accordance with the law.
In FX v Clinical Director of the Central Mental Hospital  IEHC 272 (03 July 2012) Hogan J held:
19. It may be that … the jurisdiction under Article 40.4.2 is a singular one, yet if this is so, let this be its own tribute to the Constitution’s unrelenting commitment to the protection of personal liberty.