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.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. In many countries, authorities may incarcerate someone for months or years without charging them. The writ of habeas corpus is a fundamental legal principle that ensures individuals' rights are protected against unlawful detention. If you have comments, please leave them in the section provided below. The purpose of this order is to ensure that the detainee is not being held unlawfully or without sufficient cause. Any prisoner, or another person acting on their behalf, may petition the court, or a judge, for a writ of habeas corpus. When a law enforcement agency detains you, you have a right to challenge the legal basis, duration, and conditions of your incarceration.