Both are extraordinary writs with deep historical roots, but they protect very different interests.
Habeas corpus and mandamus are sometimes confused because both are described as "extraordinary writs," but their purposes could hardly be more different.
What habeas corpus protects
Habeas corpus, Latin for "you shall have the body," is specifically designed to challenge unlawful detention or imprisonment. It asks a court to determine whether the government has a lawful basis for holding someone in custody, and if not, to order their release.
What mandamus protects
Mandamus, by contrast, is about compelling performance of a legal duty — it has nothing inherently to do with physical custody or detention, though the two occasionally intersect in the immigration detention context.
Where the two can overlap: immigration detention
An individual held in immigration detention while an application remains unadjudicated may, in some circumstances, pursue both remedies together — habeas corpus to challenge the legality of continued detention, and mandamus to compel a decision on the underlying application driving that detention.
Different constitutional and statutory foundations
Habeas corpus has explicit constitutional protection under the Suspension Clause of the U.S. Constitution, giving it a distinct pedigree separate from the statutory and common-law basis of modern mandamus.
Why the distinction matters for petitioners
Someone challenging the fact or duration of their detention should look to habeas corpus procedures, while someone challenging an agency's failure to make a decision should look to mandamus — and understanding which problem you actually have is the first step toward choosing the correct filing.
What each petition must plead, and against whom
The threshold questions are different, and getting one wrong sends the filing to the wrong court against the wrong respondent. Habeas begins with custody; mandamus begins with a duty.
| Habeas corpus | Mandamus | |
|---|---|---|
| Statutory hook | 28 U.S.C. § 2241; § 2254 for state prisoners, § 2255 for federal sentences | 28 U.S.C. § 1361 in a district court; § 1651 with Fed. R. App. P. 21 in a court of appeals |
| Threshold requirement | Custody, and a claim that it violates the Constitution, laws, or treaties of the United States | A clear, non-discretionary duty owed to the petitioner and no other adequate remedy |
| Proper respondent | The immediate custodian — the person with day-to-day control over the petitioner: Rumsfeld v. Padilla, 542 U.S. 426 (2004) | The officer, employee, or agency that owes the duty, sued in an official capacity |
| Where it is filed | A district with jurisdiction over that custodian, which for a detained person usually means the district of confinement | Venue under 28 U.S.C. § 1391(e), including the district where the plaintiff resides |
| How fast the court must move | 28 U.S.C. § 2243 requires the court to award the writ or order the respondent to show cause; the return is due within three days, extendable to twenty for good cause | No comparable timetable; the government answers within 60 days under Fed. R. Civ. P. 12(a)(2) |
| Filing fee | $5 on an application for habeas corpus, 28 U.S.C. § 1914(a) | The ordinary civil filing fee |
| What relief looks like | Release, or an order conditioning continued detention on some corrective step | An order to perform the specific act, and nothing about custody |
When habeas is the only vehicle and mandamus will not do
Where the relief sought is release or a shorter period of confinement, habeas is exclusive. Preiser v. Rodriguez, 411 U.S. 475 (1973), holds that a prisoner attacking the fact or duration of confinement must proceed in habeas rather than through an ordinary civil action, and the same logic closes the mandamus route: no ministerial duty analysis reaches the lawfulness of detention.
Immigration is where the two are most often confused, because one person may have both problems at once. A stalled application and prolonged detention are distinct claims. Zadvydas v. Davis, 533 U.S. 678 (2001), read 8 U.S.C. § 1231(a)(6) to authorize detention after a removal order only for a period reasonably necessary to bring about removal, treating six months as presumptively reasonable; that challenge is habeas. A petition asking USCIS to decide a pending application is mandamus paired with 5 U.S.C. § 706(1). Filing each claim as the other loses the correct respondent and the correct standard.
The jurisdictional walls neither writ climbs
Both remedies stop where Congress has channeled review elsewhere. Under 8 U.S.C. § 1252(a)(5) a petition for review in a court of appeals is the sole and exclusive means of judicial review of an order of removal, and § 1252(b)(9) consolidates questions arising from removal proceedings into that same review. Recasting such a claim as habeas or as mandamus does not open a door the statute closed.
- Mandamus cannot order anyone released; the writ commands performance of a duty, not a change in custody.
- Habeas cannot order an agency to adjudicate a benefit, because the claim is about the legality of detention rather than the pace of a decision.
- 28 U.S.C. § 1651 supplies no independent jurisdiction, so neither writ supplements authority a statute withholds.
- Habeas relief for a state prisoner carries its own restrictions under 28 U.S.C. § 2254, including exhaustion of state remedies, that have no analogue in mandamus practice.
Key points
- Habeas requires custody; mandamus requires a clear duty — the threshold question, not the writ's history, decides which one applies.
- The habeas respondent is the immediate custodian under Rumsfeld v. Padilla, 542 U.S. 426 (2004), while a mandamus respondent is the officer who owes the duty.
- 28 U.S.C. § 2243 puts a habeas court on a short clock: the return is due in three days, extendable to twenty for good cause.
- A challenge to the fact or duration of confinement belongs in habeas under Preiser v. Rodriguez, 411 U.S. 475 (1973), not in a mandamus action.
- 8 U.S.C. § 1252(a)(5) and § 1252(b)(9) channel removal-related claims into a petition for review, and neither writ bypasses that channel.