A writ of habeas corpus is a petition to undo something "unlawful. " A writ of habeas corpus could be to over-turn a decades old conviction or a demand bond.So, a writ of habeas corpus is a court order to bring a person who's been detained to court to determine whether or not their detention is valid. A writ of habeas corpus is an order from a court to an official to produce an inmate. A writ of habeas corpus is a legal order that commands an individual or entity to produce a person who is allegedly being detained unlawfully. Habeas petitions provide prisoners whose rights are being violated with a means of requesting assistance from a judge. The writ of habeas corpus is the remedy to be used when any person is restrained in his liberty. The purpose of this order is to ensure that the detainee is not being held unlawfully or without sufficient cause. A writ of habeas corpus is a legal order that requires the custodian to bring the detained individual before a court or judge. In both federal and Texas law, Writs of Habeas Corpus allow convicted individuals to introduce new evidence that wasn't at trial.