In United States law, habeas corpus (/ˈheɪbiəs ˈkɔːrpəs/) is a recourse challenging the reasons or conditions of a person's confinement under color of law. A petition for habeas corpus is filed with a court that has jurisdiction over the custodian, and if granted, a writ is issued directing the custodian to bring the confined person before the court for examination into those reasons or conditions. The Suspension Clause of the United States Constitution specifically included the English common law procedure in Article One, Section 9, clause 2, which demands that "The privilege of the writ of habeas corpus shall not be suspended, unless when in cases of rebellion or invasion the public safety may require it."
United States law affords persons the right to petition the federal courts for a writ of habeas corpus. Individual states also afford persons the ability to petition their own state court systems for habeas corpus pursuant to their respective constitutions and laws when held or sentenced by state authorities.
Federal habeas review did not extend to those in state custody until almost a century after the nation's founding until the Habeas Corpus Act of 1867.[1] During the Civil War and Reconstruction, as later during the War on Terrorism, the right to petition for a writ of habeas corpus was substantially curtailed for persons accused of engaging in certain conduct. In reaction to the former, and to ensure state courts enforced federal law, a Reconstruction Act for the first time extended the right of federal court habeas review to those in the custody of state courts (prisons and jails), expanding the writ essentially to all imprisoned on American soil. The federal habeas statute that resulted, with substantial amendments, is now at 28 U.S.C. § 2241. For many decades, the great majority of habeas petitions reviewed in federal court have been filed by those confined in state prisons by sentence of a state court for state crimes (e.g., murder, rape, robbery, etc.), since in the American system, most crimes have historically been a matter of state law.
The right of habeas corpus is not a right against unlawful arrest, but rather a right to be released from imprisonment after such arrest. If one believes the arrest is without legal merit and subsequently refuses to come willingly, he still may be guilty of resisting arrest, which can sometimes be a crime in and of itself (even if the initial arrest itself was illegal) depending on the state.