Essentially, a writ of habeas corpus is a legal means for any person who is restrained in his liberty to challenge an unlawful restraint. The writ of habeas corpus is the remedy to be used when any person is restrained in his liberty.A writ of habeas corpus refers to a court order that is issued to either an agency or a person who is holding someone in custody. Habeas corpus, which is Latin for "you may have the body," is a legal principle that protects against unlawful detention or imprisonment. In Texas, the state writ of habeas corpus is a legal mechanism that allows individuals to challenge their detention or imprisonment. What Is Habeas Corpus? An application for a writ of habeas corpus asks a court to overturn your conviction because of a state or federal constitutional violation. The law in the area is an intricate weave of statute and case law. Habeas corpus literally means "produce the body. The procedures required in state habeas work vary somewhat depending upon the nature of the case – i.e.