Habeas Corpus, in the Federal Court, is a petition that claims that you are being detained against your US constitutional rights. A Writ of Habeas Corpus is a civil proceeding that is available in both State and Federal Court to challenge the legality of imprisonment.To get a writ of habeas corpus, you must file a petition for a civil (not criminal) proceeding in either state or federal court. The Writ of Habeas Corpus is a legal defense against unlawful incarceration. The Writ of Habeas Corpus protects prison inmates from false imprisonment to ensure people are not thrown into jail unlawfully. The writ of habeas corpus primarily acts as a writ of inquiry, issued to test the reasons or grounds for restraint and detention. A Writ of Habeas Corpus may be an option for you if you or someone you love is being held in jail, prison, or a mental health institution. To be allowed to petition for a Writ of Habeas Corpus, you must first "exhaust your remedies. The Habeas Corpus petition claims the arrest, sentence, or trial violated constitutional law, making imprisonment unlawful. See rules 4.5504.552 of the California Rules of.