A writ of habeas corpus is a court order to an institution ordering a prisoner brought to the court on the grounds of possible unlawful imprisonment. The prisoner or a lawyer does not write the writ but rather write a petition to grant the writ. To do this, the petitioner fills out the proper state or federal form giving the facts of the custody and legal basis for the petition.
Habeas corpus, which in Latin means "you have the body," is a legal means for citizens to avoid being held without trial and to protest improper jail conditions. If the custodian cannot prove justification for the imprisonment, the court can order the prisoner's release. The U.S. Constitution provides for habeas corpus, as do many state constitutions. For a writ of habeas corpus to be granted, the prisoner must already be in custody, and the state appeal process must already have been exhausted.
In a habeas corpus review, a court is allowed to consider new evidence. Due process provides prisoners with guaranteed rights such as the right to counsel, protection from unlawful search and seizure, and a fair and speedy trial by a jury of peers. Habeas corpus is commonly used as a post-conviction last resort by prisoners who are convinced that one or more of their due process rights were violated during the course of the judicial proceedings leading to their imprisonment.