Habeas corpus is a legal procedure and a fundamental safeguard against unlawful detention or imprisonment. It is a writ (court order) that commands a person or authority holding someone in custody-usually a prison official-to bring the detainee before a court. The court then examines whether the detention is lawful. If the custodian cannot justify the detention legally, the court orders the prisoner's release. The term "habeas corpus" comes from Medieval Latin, meaning "you shall have the body," referring to the requirement that the detained person be physically brought before the court
. This writ serves as a protection of individual liberty by ensuring that no one is held without legal cause. It is used to challenge unlawful imprisonment and to prevent arbitrary detention by the state or other authorities. Habeas corpus does not determine guilt or innocence but strictly addresses the legality of the detention itself
. Historically, habeas corpus originated in English common law and was codified notably in the Habeas Corpus Act of 1679. It remains a vital legal instrument in many Anglo-American legal systems, including the United States and the United Kingdom
. In modern usage, habeas corpus is often employed by prisoners to challenge the legality of their detention, including cases involving criminal convictions, immigration detention, and military custody. It ensures due process by requiring authorities to justify the detention in court
. In summary, habeas corpus is a judicial writ that protects individuals from illegal detention by requiring authorities to bring detainees before a court to assess the lawfulness of their imprisonment