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

The extraordinary writs, side by sideFour columns, one per writ. Mandamus compels action, directed at a ministerial duty-holder, for example ordering USCIS to decide a stalled petition. Prohibition forbids action, directed at a court exceeding its jurisdiction. Certiorari brings up the record for review, directed at a lower tribunal's decision. Habeas corpus tests the legality of detention, directed at the custodian holding the petitioner. A bottom band spanning all four notes that all are discretionary and none is a substitute for appeal.THE WRITMandamusCompels actionDIRECTED ATA ministerialduty-holderEXAMPLEOrdering USCIS todecide a stalledpetition.THE WRITProhibitionForbids actionDIRECTED ATA court exceedingits jurisdictionEXAMPLEStopping a trialcourt that lacksjurisdiction.THE WRITCertiorariBrings up the recordfor reviewDIRECTED ATA lower tribunal'sdecisionEXAMPLEThe Supreme Courtreviewing a circuitruling.THE WRITHabeas corpusTests the legalityof detentionDIRECTED ATThe custodianholding thepetitionerEXAMPLEChallenging unlawfulimmigrationdetention.All are discretionary. None is a substitute for appeal.
Fig. — The extraordinary writs, side by side

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 corpusMandamus
Statutory hook28 U.S.C. § 2241; § 2254 for state prisoners, § 2255 for federal sentences28 U.S.C. § 1361 in a district court; § 1651 with Fed. R. App. P. 21 in a court of appeals
Threshold requirementCustody, and a claim that it violates the Constitution, laws, or treaties of the United StatesA clear, non-discretionary duty owed to the petitioner and no other adequate remedy
Proper respondentThe 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 filedA district with jurisdiction over that custodian, which for a detained person usually means the district of confinementVenue under 28 U.S.C. § 1391(e), including the district where the plaintiff resides
How fast the court must move28 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 causeNo 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 likeRelease, or an order conditioning continued detention on some corrective stepAn 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.

Reference authority

  • 28 U.S.C. § 1361 — grants federal district courts original jurisdiction over mandamus actions against federal officers.
  • 28 U.S.C. § 1651 — the All Writs Act: the auxiliary power under which appellate courts supervise the courts below
  • 28 U.S.C. § 1391(e) — venue against a federal officer or agency, usually including the plaintiff's own district
  • Fed. R. App. P. 21 — governs the form and procedure for petitioning a court of appeals for mandamus.
  • Fed. R. Civ. P. 12(a)(2) — the United States has 60 days to respond, and silence in that window is not a default
Educational information only. This article explains general legal principles for research purposes and does not constitute legal advice. Mandamus procedure and standards vary by jurisdiction and change over time. If you have an active legal matter, consult a licensed attorney in your state or the relevant federal circuit.