The writ of habeas corpus is the remedy to be used when any person is restrained in his liberty. A Writ of Habeas Corpus (Latin for "that you have the body") may be filed on behalf of a person who is unlawfully imprisoned.In Texas, the state writ of habeas corpus is a legal mechanism that allows individuals to challenge their detention or imprisonment. In Texas, a writ of habeas corpus is a court order in which the judge demands a law enforcement agency to produce a detainee for a court hearing. In a writ of habeas corpus, a defendant seeks to establish that his or her prison sentence is illegal. This can be done in two ways. A writ of habeas corpus is another means to fighting the legality of one's incarceration or proving actual innocence. If the application is filed prior to disposition of the case, it is filed in the assigned District Court or County Criminal Court at Law. Please carefully read through all the steps listed below before you begin. A writ of habeas corpus is a powerful legal tool that allows individuals to challenge a criminal conviction or sentence.