Who May Use This Form. 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.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. Federal habeas corpus is a procedure under which a federal court may review the legality of an individual's incarceration. § 2244(d), within which state and federal prisoners must file their federal habeas petitions. 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. State Prisoners in Federal Criminal Cases. The U.S. Marshal will transport, maintain custody, and produce a state prisoner in a federal criminal action. Suppose you have been incarcerated due to a criminal accusation or conviction in state or federal court.