The writ of habeas corpus is the remedy to be used when any person is restrained in his liberty. In Texas, the state writ of habeas corpus is a legal mechanism that allows individuals to challenge their detention or imprisonment.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. Its main purpose is to protect citizens from governments overreaching their power to incarcerate people. A writ of habeas corpus gives a jailed suspect the right to ask an appellate judge to set them free or order an end to their improper jail conditions. Fill out the Petition for Writ of Habeas Corpus to Return Child. An application for a writ of habeas corpus asks a court to overturn your conviction because of a state or federal constitutional violation. Fill out the Petition for Writ of Habeas Corpus to Return Child. In some cases, a defendant can be released from jail post-conviction if he or she has been denied their fundamental rights. A 11.07 Writ of Habeas Corpus can provide you with postconviction relief.