Habeas corpus ( /ˌheɪbɪəs ˈkɔrpəs/; Latin: "that you might have the body") is a writ (legal action) which requires a person under arrest to be brought before a judge or into court. This ensures that a prisoner can be released from unlawful detention—that is, detention lacking sufficient cause or evidence. The remedy can be sought by the prisoner or by another person coming to the prisoner's aid. This right originated in the English legal system, and is now available in many nations. It has historically been an important legal instrument safeguarding individual freedom against arbitrary state action.
A writ of habeas corpus, also known as the "great writ", is a summons with the force of a court order; it is addressed to the custodian (a prison official for example) and demands that a prisoner be taken before the court, and that the custodian present proof of authority, allowing the court to determine whether the custodian has lawful authority to detain the prisoner. If the custodian is acting beyond his authority then the prisoner must be released. Any prisoner, or another person acting on his or her behalf, may petition the court, or a judge, for a writ of habeas corpus. One reason for the writ to be sought by a person other than the prisoner is that the detainee might be held incommunicado. Most civil law jurisdictions provide a similar remedy for those unlawfully detained, but this is not always called "habeas corpus". For example, in some Spanish-speaking nations, the equivalent remedy for unlawful imprisonment is the amparo de libertad ('protection of freedom').
Habeas corpus has certain limitations. It is technically only a procedural remedy; it is a guarantee against any detention that is forbidden by law, but it does not necessarily protect other rights, such as the entitlement to a fair trial. So if an imposition such as internment without trial is permitted by the law then habeas corpus may not be a useful remedy. Furthermore, in many countries, the process may be suspended because of a national emergency.
The right to petition for a writ of habeas corpus has nonetheless long been celebrated as the most efficient safeguard of the liberty of the subject. The jurist Albert Venn Dicey wrote that the British Habeas Corpus Acts "declare no principle and define no rights, but they are for practical purposes worth a hundred constitutional articles guaranteeing individual liberty".
The writ of habeas corpus is one of what are called the "extraordinary", "common law", or "prerogative writs", which were historically issued by the English courts in the name of the monarch to control inferior courts and public authorities within the kingdom. The most common of the other such prerogative writs are quo warranto, prohibito, mandamus, procedendo, and certiorari. The due process for such petitions is not simply civil or criminal, because they incorporate the presumption of non-authority. The official who is the respondent has the burden to prove his authority to do or not do something. Failing this, the court must decide for the petitioner, who may be any person, not just an interested party. This differs from a motion in a civil process in which the movant must have standing, and bears the burden of proof.