Your loved one is detained. Their attorney just told you, “We’re filing a writ.” You nod, but you have no idea what that means. The word sounds urgent and legal, and it’s something you should probably understand right now.
You’re not alone. A writ is not as mysterious as it sounds. It’s a written order from a court, and in custody contexts, it’s often the single most important document standing between your family member and continued confinement. This guide explains what a writ actually is, the five types that affect people in jail or detention, and how to know which one your situation calls for.

A “Writ” in the Simplest Terms
A writ is a written order issued by a court, telling someone (usually a government official) to do something or stop doing something. The word comes from Old English writan, meaning “to write.” In modern American law, federal courts derive their authority to issue writs from the All Writs Act, which lets the Supreme Court and all federal courts issue any writs necessary to support their jurisdiction.
What sets a writ apart from a regular court ruling is its character as an extraordinary remedy. Courts issue writs only when no other adequate legal path exists, when ordinary appeals or motions have failed or do not apply. That is why a writ tends to enter the picture precisely when other doors have closed.
Why You Hear This Word When Someone’s in Jail
When someone is held in custody (in a county jail, a federal facility, or an immigration detention center), they are inside a system run by the executive branch of government. Sheriffs, the Bureau of Prisons, and Immigration and Customs Enforcement all operate under executive authority. The judiciary is a separate branch entirely, with its own constitutional power to review what other branches do.
A writ is the formal mechanism that lets the judicial branch step into a custody situation and ask one question: Is this detention legal? It can also compel an official action that has been wrongly delayed, force the production of a person for court, or order a higher court to review a lower court’s decision. Without writs, a person in jail would have no direct way to get a federal judge to look at their case. That is why families hear this word so often when a loved one is detained.
The 5 Writs That Actually Affect People in Custody
Many writs exist in legal history, but only a handful regularly come up when someone is detained. These five matter most.
Writ of Habeas Corpus: “Produce the Body”
The most important writ for anyone in custody, habeas corpus is Latin for “you shall have the body.” It commands the official holding a person (a warden, a sheriff, an ICE field office director) to bring that person before a federal judge and explain the legal basis for the detention. If the government cannot justify the confinement, the judge can order release. This is the writ behind almost every successful federal court challenge to ICE detention, filed under 28 U.S.C. § 2241.
Writ of Habeas Corpus Ad Prosequendum: For Prosecution
This variant orders the custodian of a prisoner to produce that person in court for prosecution in another case, typically when the same individual faces charges across different jurisdictions. According to U.S. Marshals Service procedure, this writ is what allows federal authorities to physically bring a state prisoner into federal court for trial, or vice versa. It is procedural rather than liberty-restoring; it does not by itself secure release.
Writ of Habeas Corpus Ad Testificandum: For Testimony
Closely related to ad prosequendum, this writ orders production of a prisoner so that the person can testify as a witness in a court proceeding. Families sometimes encounter this when a detained relative is needed to give sworn testimony in another family member’s case. Like its sibling writ, it concerns transport and appearance, not detention validity.
Writ of Mandamus: To Compel Official Action
A mandamus writ orders a government official to perform a duty that the law clearly requires. In the immigration context, mandamus is most often used to push USCIS to decide an application that has sat unreasonably long. In jail contexts, it can be used to compel a court clerk, a prison administrator, or another official to act when they have refused to do something they are legally obligated to do.
Writ of Certiorari: To Review a Case
This is the writ a higher court (most famously the U.S. Supreme Court) uses to order a lower court to send up the record of a case for review. When you read that the Supreme Court “granted cert” in a high-profile criminal case, this is the writ at work. For a person in custody, certiorari matters mainly as a final appellate path after lower courts have ruled.
How Does a Writ Get a Person Out of Jail?
Of the five writs above, only habeas corpus directly challenges whether someone should be held at all. When a habeas petition is filed in federal district court, the government must respond and justify the detention. The judge can then order one of several outcomes: outright release, a court-ordered bond hearing, transfer to less restrictive custody, or, if the petition fails, denial with the option to appeal.
Timing varies. Some habeas cases resolve in two to three weeks; others take a few months. Emergency petitions can move within days when the legal grounds are strong and the harm is imminent. Speed depends on the federal district, the assigned judge, and how clearly the detention violates a statute or the Constitution.
Has your loved one been held for months without a bond hearing? Prolonged detention is one of the most common grounds for a successful habeas petition. The earlier the case is reviewed, the stronger the timeline arguments tend to be.
Writs in Immigration Detention: Key Differences
Immigration detention is civil, not criminal. That distinction matters enormously. A person held by ICE has not necessarily been convicted of any crime; they are in custody pending the outcome of removal proceedings. Yet the conditions can resemble incarceration, and detention can stretch for months or years. Because immigration courts sit inside the executive branch (they are part of the Department of Justice), they cannot offer the independent constitutional review that a federal Article III judge can. That is exactly the gap habeas corpus fills.
The numbers reflect this reality. According to ProPublica’s Habeas Tracker, immigrants filed more habeas cases in the first thirteen months of the second Trump administration than in the past three administrations combined. The Indiana Lawyer reported that more than 9,500 immigration-related habeas filings were pending in federal district courts as of early 2026. These petitions are not symbolic. Many succeed, often resulting in court-ordered bond hearings or direct release.

The other four writs play smaller roles in immigration detention. Mandamus is generally used to challenge USCIS adjudication delays rather than detention itself. Ad prosequendum and ad testificandum sometimes appear when a detained person is needed for a separate criminal matter. Certiorari sits at the far end of any appellate journey. For most families with a loved one in ICE custody, the writ that matters is habeas corpus, filed as a federal habeas petition in the appropriate U.S. District Court.
When to Talk to a Lawyer About Filing a Writ
Some warning signs should prompt an immediate call to an attorney experienced in federal habeas litigation. These include detention that has stretched past six months without a meaningful bond hearing, a flat denial of any bond hearing based on a contested mandatory detention classification, an ICE transfer that moves a loved one away from family or counsel, signs of due process violations such as denied access to counsel, or re-detention after a long period of compliance with supervised release.
One detail families often miss: the writ must be filed in the federal district where the person is physically held, not where the family lives or where the case originated. ICE transfers between facilities can affect which federal court has jurisdiction. The first 72 hours after a detention or transfer often determine how quickly a habeas petition can be filed and heard.
What to Do When a Loved One Is Detained
If your family is in this situation right now, the most important thing is not to wait. A writ is a tool, but it only works when someone with federal court experience picks it up and uses it on time. Of the five writs we covered, habeas corpus is the one that can actually open the door, and the early days of detention often shape how quickly that happens.
Locate the facility where your loved one is held. Note the exact date custody began. Save any paperwork ICE provided. Then talk to an attorney who handles federal habeas petitions, not just immigration court matters. The two are very different practices, and the difference often shows in the result.
Is a loved one in ICE detention? Time is critical. A habeas corpus petition can be a powerful tool to challenge unlawful detention. Reach out to us at (862) 799-2200 for a free case evaluation, and our team will review the situation and give you a clear path forward, no cost, no obligation.
Legal Disclaimer
This article is provided for general informational purposes only and does not constitute legal advice. Every immigration case has unique circumstances. For legal guidance specific to your situation, we recommend consulting with an experienced immigration attorney. The information in this article reflects laws and policies as of the publication date; subsequent changes may affect its accuracy.
Sources
- Writ — Wex Legal Dictionary, Cornell Law School Legal Information Institute, evergreen reference.
- 28 U.S.C. § 2241 — Power to grant writ, Cornell Law School Legal Information Institute, current statute.
- Writs of Habeas Corpus & Special Requests for Production, U.S. Marshals Service, official agency reference.
- Types of Writs in Criminal Law, FindLaw, May 13, 2025.
- Writs of Habeas Corpus, FindLaw, January 15, 2026.
- Federal Habeas Corpus: A Legal Overview, Congressional Research Service (Charles Doyle), October 2024.
- Tracking the Rise of Immigration-Related Habeas Corpus Cases, ProPublica, February 10, 2026.
- New habeas corpus strategy is freeing some immigrant detainees, The Indiana Lawyer, January 23, 2026.
Every day in detention is a day away from your family.
If the immigration system has failed you, federal court may be the only answer. Let us review your case for free.
Get a Free Case Evaluation