Every person restrained of his or her liberty under any pretense whatever, may prosecute a writ of habeas corpus to inquire into the cause of the restraint. It demands a person's release from unlawful detention.A writ of habeas corpus requires that a person who is in custody be brought before a judge or court and that they be able to challenge that custody. • 2254 Petition for Writ of Habeas Corpus (28 U.S.C § 2254). WRIT OF HABEAS CORPUS ISSUED TO: Check the boxes and ill in blanks as needed to show what you want the court to order. ❖ Do not date and sign at the end. This Chapter explains an important right—the writ of habeas corpus. It tests the legality of a detention or a restraint and the goal is to use it really almost i guess it's an emergency basis. The writ's purpose is to challenge the legality of detention and seek relief from unlawful imprisonment. This petition, called a writ of Habeas Corpus, is filed in Federal Court (US District Court ) whether you are serving time in a federal or state prison.