If you want to challenge your immigration detention or other immigration related issues, you should use the form Petition for a Writ of Habeas Corpus under 28. Petition for Writ of Habeas Corpus.Public defenders can use these practice materials. For further Guidance Documents, Administrative Orders, Memos, Press Releases, etc. Petition for a Writ of Habeas Corpus Under 28 U.S.C. § 2241. Download. First, a U.S.C. § 2254 allows us to file a petition for Habeas Corpus when the client is in custody under sentence of a state court and is in a state prison. To get a writ of habeas corpus, you must file a petition for a civil (not criminal) proceeding in either state or federal court. A Habeas Corpus Writ is filed with a federal court once the defendant's state appellate remedies have been exhausted. A seasoned New York habeas corpus lawyer can guide and represent you in the filing and litigation of a motion for a writ of habeas corpus. A New York Family Lawyer said the respondent wife moved out of the marital residence.