Because the purpose of the petition is to gain the release of an unlawfully detained person, the reasons that justify the writ are narrowly defined. A Writ of Habeas Corpus is a civil proceeding that is available in both State and Federal Court to challenge the legality of imprisonment.A writ of habeas corpus is a judicial mandate to a prison official, usually the warden, ordering that an inmate be brought to the court. Habeas Corpus, in the Federal Court, is a petition that claims that you are being detained against your US constitutional rights. Federal Habeas Corpus. This article addresses a defendant's right to file a federal petition for a writ of habeas corpus from a conviction in a state court. This Chapter discusses how the writ of habeas corpus is applied in three states: Florida, New York, and Michigan. The "Great Writ" of habeas corpus is a fundamental right in the Constitution that protects against unlawful and indefinite imprisonment. 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. Southern District of New York is the proper district to file a § 2254 petition.