A writ of habeas corpus in the United States is intended to prevent illegal arrest, imprisonment or detention. According to the Legal Information Institute of Cornell Law School, federal courts are able to use a writ of habeas corpus to decide whether or not an individual state's detention of an individual is valid.
The Legal Information Institute explains that a habeas petition works as a civil action to examine the extradition processes employed by the detaining agency, the amount of bail ordered and whether the jurisdiction of the court is valid. It also points out that habeas corpus in modern society is most commonly used as a post-conviction remedy for potentially illegal applications of federal laws used to detain state or federal prisoners. It is also often employed in cases of immigration and deportation proceedings as well as military detentions and convictions. In criminal cases, the Legal Information Institute indicates that habeas corpus helps justify or cast doubt on preliminary matters, such as claims of double jeopardy, rights to a speedy trial, denial of bail, removal to other facilities and adequate basis for detentions.
Encyclopaedia Britannica identifies habeas corpus as an ancient common-law writ used most importantly "to correct violations of personal liberty by directing judicial inquiry into the legality of a detention."