Habeas Corpus
Overview
The habeas corpus procedure upholds the basic principle of law that a person shall not be deprived of his or her liberty save in accordance with law. Habeas corpus is a very ancient remedy by which the higher courts may inquire into the legality of a person’s detention.
The remedy of habeas corpus was developed at common law. It was placed on the statutory basis in Ireland in 1782 upon reestablishment of the Irish parliament. A person or authority holding another in detention or in prison was required within three days to make a return and bring the person before the court in which the writ is issued to certify the legality of the detention.
The Constitution provides specifically for a procedure equivalent to habeas corpus. Upon complaint to the High Court by or on behalf of a person alleging that a person is being unlawfully detained, the High Court is to forthwith enquire into such complaint.
Constitutional Procedure
The court may order the person to be produced before the court on a named day and require the body or person having the person in its detention to certify the grounds of his detention. The detained person is not necessarily produced in  court.
The High Court may at the time of such reference, or any time thereafter allow the detained person to be at liberty on bail subject to such conditions as may be fixed pending the determination of the legality of detention by the Court.  The High Court on having the person detained produced and after giving the person detaining, the opportunity of justifying the detention, must order the release of the detained person from custody unless it is satisfied that he is being detained in accordance with the law.
If the High Court is satisfied that the person is being detained in accordance with  law, but the law is unconstitutional, the High Court shall refer the question of validity to the Court of Appeal (formerly the Supreme Court) by way of case stated.
Procedure
The matter may be directed to be heard before three High Court judges by the President of the High Court. Provision for habeas corpus does not apply to prohibit, control or interfere with the Defence Forces during the existence of state of war or armed rebellion.
Applications by way of habeas corpus are given priority and take precedence over other judicial work. In appropriate cases, adjournments may be granted where necessary. If difficult questions arise, bail may be afforded.
The initial application to the High Court is made by way of a unilateral application based on affidavit. A more informal complaint may be made by or on behalf of the person detained, even by letter. The procedure may be undertaken relatively informally. Exceptionally, the judge may play a more inquisitorial rule where this is necessary to safeguard the liberty of the citizen.
The response is by affidavit by the person against whom the order is made. The affidavit must justify the full circumstances and legality of the detention. Disobedience of order may be enforced by attachment and comital.
Conditional Order
A conditional order may be granted, to be served within 10 days or such further time as the court may be allowed. Cause must be shown by the respondent within 10 days thereafter. The respondent generally shows cause by affidavit.
Where cause is shown, an application may be made by motion on notice, to make a conditional order absolute, notwithstanding that cause has been shown. The notice of motion must be made within six days of respondents showing cause or within six days after notice of filing of the last notice.
Even the procedure is brought under the Constitution does not require physical production of the detained person concerned in each case. The court may require the production of the person.
The person does not have a right to be produced. The person is likely to be produced where this is necessary to enquire properly into the legality of detention.
On Behalf of Another
The application for habeas corpus may be brought by or on behalf of the detained person. In some cases, the application can be made even without the express authority of the detained person. This may be done in exceptional circumstances by a solicitor where the person lacks capacity or is not in a practical position to initiate a challenge.
Once the preliminary order is made, there is no further function for the third party in relation to the application. The detained person must make the application from that point onward.
Release and Re-arrest
If detention is found to be unlawful releases, a release order must not be made for the purpose of immediate arrest. The new arrest must be in accordance with the general law and be on a lawful basis.
A meaningful time must elapse between release and re-arrest. A person he or she is re-arrested if they are detained, even if though they are not formally arrested. Re-arrest must not be for the purpose of re-litigating the same issue in the proceedings.
Successive Applications and Appeal
A person refused habeas corpus may appeal. An appeal may be taken by either applicant or respondent.
Historically an applicant could apply to successive High Court judges seeking habeas corpus. It is now established that the only remedy if the order is refused or is not given in terms requested, is to by way of appeal.
There may be some scope for an application to be made where new grounds exist following a refusal to release the applicant from detention. A subsequent application may be made where new grounds arise, or fresh new evidence comes to light.
The respondent must be given the opportunity to justify detention. This is central to the Constitutional procedure. The detained person may be released if the person who detains him cannot justify detention in accordance with law.
Fundamental Illegality
Not every defect or illegality relating to detention will necessarily require that the person be released in habeas corpus proceedings. The default must relate to a fundamental aspect of the legality.
A mere impropriety or technical error or unintentional exceeding of jurisdiction will not generally suffice. There must be a fundamental departure from basic fair procedures or other fundamental illegality.
This principle applies more strictly in relation to persons convicted of criminal offences. The courts will not wish to have persons who have been convicted released on a mere technicality.
In other cases, the court may take a stricter view and may order release on convicted persons whose detention cannot be legally justified in accordance with law. In the case of persons detained under the Mental Health legislation or detained pretrial, a stricter approach is likely to be taken.
Criminal Pre-Trial
The procedure is almost always applicable to pre-trial detention. Where a person has been convicted, there must be exceptional circumstances before the court will enquire into issues of legality to its procedure.
The procedure may be used to challenge warrants, orders of conviction, committal and detention. In these types of case, a copy of the relevant order or conviction must be produced to the court by the person holding the applicant in custody.
Convicted Persons
Irregularity in a criminal trial will rarely be sufficient to justify release on application by way of habeas corpus. The defects must be such that they invalidate essential steps in the trial in order to justify release. Where there is a fundamental breach of fair procedures habeas corpus is likely to issue. If a sentence is imposed without legal authority, it may be quashed, and the person may be released.
The court will allow an application under Article 40 by a lawfully imprisoned person only in exceptional circumstances. Exceptionally the conditions of detention may amount to a fundamental breach of constitutional rights. In this case the court may in principle order release, although this will rarely be done
If there is a deliberate and conscious violation of constitutional rights, if prisoner has been subjected to inhuman and degrading treatment or is being n held in circumstances which would endanger life and health, a challenge may be allowed.
Exceptionally, a denial of resort to legal advice may in some cases may invalidate the legality of detention.
Non-Criminal Contexts
A Habeas corpus application that may be made in a range of circumstances where persons are detained notwithstanding that no crime is alleged. In some cases,  unlawful immigrants may be detained.  Persons may be detained for their own safety and by reason of their mental health under mental health legislation.
The procedure may also be used   in respect of guardianship and custody of minors where a person is in the custody of the State. In recent times, modern legislation is usually used.