If you want to challenge your immigration detention, you may use the form Petition for a Writ of Habeas Corpus under 28 U.S.C. § 2241 (For Immigration Matters). Forms Find a national federal court form that can be used in all federal courts.A 2254 petition must be filed in the federal district court that has jurisdiction over the county where the conviction occurred. It provides an expeditious remedy for correcting erroneous sentences without resort to habeas corpus. Federal prisoners may file two different kinds of motions for post-conviction relief: "Section 2255 motions" and "Section 2241 habeas corpus petitions." Federal Writ of Habeas Corpus For Those In Federal Custody 28 USCA 2255.