The writ of habeas corpus is a fundamental legal instrument that protects individuals from unlawful detention. Derived from the Latin…