Petition for Writ of Habeas Corpus. 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.To get a writ of habeas corpus, you must file a petition for a civil (not criminal) proceeding in either state or federal court. How Do I Fill Out the Form? There is an official form (Judicial Council Form HC-001) for filing a state petition for writ of habeas corpus. To challenge your conviction, speak with an OC criminal defense lawyer about a Writ of Habeas Corpus at (714) 530-9690. 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. Common Grounds for Habeas Petitions. In California, any conviction of a crime can be appealed. The attorney general represents the state or territory in a federal habeas corpus proceeding.