The Writ of Habeas Corpus demands that requires a prisoner must go before the court to determine if there is lawful authority to detain the prisoner. The writ of habeas corpus primarily acts as a writ of inquiry, issued to test the reasons or grounds for restraint and detention.Criminal habeas corpus writs are procedures used to test the legality and correctness of a prisoner's detention. This Chapter explains an important right—the writ of habeas corpus. Prisoners can sometimes use a petition for writ of habeas corpus to challenge the legality of a criminal conviction or inhumane prison conditions. The writ of habeas corpus is a legal order requiring a person holding another person to produce that individual before a court or judge. Federal habeas corpus is a procedure under which a federal court may review the legality of an individual's incarceration. A writ of habeas corpus is a legal rule that gives a prisoner the right to request court assistance and show that they've been wrongfully imprisoned. A Writ of Habeas Corpus is a motion which is filed most frequently to ensure that a Defendant's imprisonment or detention is not illegal. The Habeas Corpus petition claims the arrest, sentence, or trial violated constitutional law, making imprisonment unlawful.