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. The writ of habeas corpus primarily acts as a writ of inquiry, issued to test the reasons or grounds for restraint and detention.Habeas Corpus, in the Federal Court, is a petition that claims that you are being detained against your US constitutional rights. You should use this form if. Prisoners can sometimes use a petition for writ of habeas corpus to challenge the legality of a criminal conviction or inhumane prison conditions. This Chapter explains an important right—the writ of habeas corpus. The privilege of the writ of habeas corpus shall not be suspended, unless when in Cases of Rebellion or Invasion the public Safety may require it. A Writ of Habeas Corpus is a civil proceeding that is available in both State and Federal Court to challenge the legality of imprisonment. Any prisoner, or another person acting on their behalf, may petition the court, or a judge, for a writ of habeas corpus. The purpose of this packet is to provide general guidance about your habeas corpus case.