Use this if you have a court order giving you custody of your child and the other parent has taken your child away from you. 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.When you file a federal habeas petition, you may only raise issues related to constitutional violations, and you have no right to the assistance of counsel. 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. Federal prisoners may file two different kinds of motions for post-conviction relief: "Section 2255 motions" and "Section 2241 habeas corpus petitions." Petition for Writ of Habeas Corpus Under 28 U.S.C. § 2254. Form: PDF icon 2254 Petition for Writ of Habeas Corpus - State Custody Rev. The writ of habeas corpus is a fundamental right that ensures that a person's detention is justified and lawful. 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. 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.