Petition for Writ of Habeas Corpus. 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.Contact an award-winning Writ of Habeas Corpus lawyer today. To get a writ of habeas corpus, you must file a petition for a civil (not criminal) proceeding in either state or federal court. If you are filing this petition in the superior court, you only need to file the original unless local rules require additional copies. The Writ of Habeas Corpus protects prison inmates from false imprisonment to ensure people are not thrown into jail unlawfully. A Writ of Habeas Corpus is a legal document that asks a court to look into the circumstances of your detention and, if necessary, change them. This manual explains how someone without a lawyer can file a petition for writ of habeas corpus in the California state courts. While conviction appeals need to be filed within very specific time limits, a Writ of Habeas Corpus petition has no deadline. A habeas court petition can be filed in state court or in federal court if all state options have been exhausted.