Insight

How to Apply for a Habeas Corpus?

How to Apply for a Habeas Corpus?

SL

Select lawyer...

April 11, 2026 04:49 AM

How to Apply for a Habeas Corpus?

Knowing that habeas corpus exists is important. Knowing how to activate it when needed is essential. Habeas corpus is not a mechanism that starts automatically, nor one that the police themselves will facilitate: it is a right that must be actively exercised, correctly and as swiftly as possible, in order to produce the effects the law assigns to it.

In situations of unlawful detention, every hour counts. The uncertainty about a family member's whereabouts, the feeling that time limits are being exceeded without anyone acting, or the certainty that fundamental rights are being violated, create enormous pressure on whoever must take action. Knowing the procedure in advance — knowing exactly what to do, before whom, within what timeframe, and with what content — can be the difference between obtaining freedom within hours and losing valuable time through not knowing how to proceed.

This article is a practical and comprehensive guide on how to apply for a habeas corpus in Spain: who can submit it, before which court the application must be filed, what the written request must contain, how the procedure is processed, what the judge can do, and what happens depending on their decision. A clear understanding of these steps is the best preparation for acting effectively when the situation demands it.

Before Applying for Habeas Corpus: Verifying That a Legal Ground Exists

The first step before submitting any habeas corpus application is to verify that one of the legal grounds justifying it is actually present. Organic Law 6/1984 exhaustively lists the situations that may form the basis of the application: detention without the required legal prerequisites, failure to meet essential formal requirements, exceeding maximum time limits, detention in an unknown location or under illegal conditions, and deprivation of liberty carried out by an unauthorised person.

A habeas corpus application that is not based on any of these grounds will not succeed, and submitting one without foundation only consumes time and energy that could be used more effectively. Therefore, the first step is to make an honest and swift assessment of the situation: Have the 72 hours been exceeded? Was the detainee not informed of their rights? Is the detainee's whereabouts unknown? Has access to a lawyer not been permitted? If any of these circumstances apply, habeas corpus is justified. If not, there may be other more appropriate procedural mechanisms.

In any case, this initial assessment should be made with the assistance of a criminal lawyer who can quickly identify whether the situation falls within one of the legal grounds and who can advise on the most appropriate strategy. Although the law does not require the involvement of a lawyer to submit a habeas corpus application, having legal counsel significantly increases the chances of success.

Who Can Submit the Application?

Organic Law 6/1984 grants the right to apply for habeas corpus to a wide circle of persons, precisely to ensure that there is always someone in a position to activate the procedure even if the detainee themselves cannot do so:

  • The detainee or person deprived of liberty, who may submit the application directly or through their representative.
  • The spouse or person in an equivalent affective relationship, even without a formal marriage bond.
  • Ascendants, descendants, and siblings of the detainee.
  • The detainee's legal representative, in cases where the detainee cannot act on their own behalf.
  • The Public Prosecutor (Ministerio Fiscal), when aware of a detention that may be unlawful.
  • The Ombudsman (Defensor del Pueblo), in the exercise of their constitutional functions.

This broad standing has a very specific purpose: to prevent habeas corpus from being blocked in cases where the detainee themselves cannot activate it — because they are held incommunicado, because they are unaware of the procedure, or because the circumstances of the detention prevent them from acting independently. In practice, it is most common for the detainee's family members, advised by a lawyer, to submit the application.

Before Which Court Must the Application Be Filed?

Correctly identifying the competent court before which the habeas corpus application must be filed is one of the most important aspects of the procedure. An error at this point can delay the process at a moment when every hour is critical.

The general rule is that the application must be filed before the investigating court (juzgado de instrucción) of the place where the detainee is being held. If the detainee is at a police station in a particular municipality, the application must be directed to the investigating court of that municipality or, outside normal business hours, to the corresponding duty court (juzgado de guardia).

When the exact place of detention is unknown, the application may be filed before the investigating court of the place where the detention occurred or, if that is also unknown, before the court of the applicant's place of residence. This provision ensures that uncertainty about the detainee's whereabouts does not prevent the procedure from being activated.

There is one important exception: when the detention has been ordered by a judge — for example, by means of a remand order — habeas corpus is not filed before the ordinary investigating court; instead, the appropriate avenue is an appeal before the Provincial Court (Audiencia Provincial). Habeas corpus operates primarily against police or extrajudicial deprivations of liberty, not against those ordered by judicial resolution. This distinction is fundamental to avoid confusing the appropriate mechanisms in each situation.

What Must the Written Application Contain?

The habeas corpus application is not subject to rigid formal requirements — which makes it easier for anyone to submit it even without legal assistance — but it must contain the minimum information needed for the judge to understand the situation and act swiftly. A well-structured application with the necessary information speeds up the process and increases the chances of success.

The essential elements that must be included are:

Identification of the Applicant The application must clearly identify who is submitting it: full name, national ID number (DNI or NIE), address, and, where applicable, their relationship to the detainee. If the applicant is acting on behalf of the detainee as a family member, legal representative, or in any other capacity, this must also be stated and, if possible, briefly evidenced.

Identification of the Detainee The person whose liberty is being sought must be identified as precisely as possible: full name, DNI or NIE if known, and any other data that allows for unambiguous identification. If any of these details are unknown, this must be stated, and whatever information is available must be provided.

Place of Detention or Known Whereabouts It is essential to indicate where the detainee is being held or, if their exact whereabouts are unknown, to state this and provide whatever information is available about the place where the detention occurred or the authority believed to have them in custody. This information enables the judge to direct their requests swiftly.

Circumstances of the Detention and Grounds for Unlawfulness The core of the application is a description of the circumstances of the detention and the reasons why it is considered unlawful. It must state when and how the detention took place, whether or not rights were communicated, whether or not legal assistance was permitted, how long the detainee has been deprived of liberty without being brought before a judge, and any other relevant circumstances that support the unlawfulness.

Technical legal precision is not required in this section, but clarity and specificity are essential. The judge needs to quickly understand what is happening in order to act with the urgency the procedure demands. A lengthy, imprecise application, or one that does not clearly identify the ground for unlawfulness, hinders judicial action and may delay the resolution.

An Express Request for Habeas Corpus The application must conclude with a clear and express request that habeas corpus proceedings be initiated, that the detainee be brought before the judge, and that, if the unlawfulness of the detention is established, their immediate release be ordered.

Form and Place of Submission

The application may be submitted in written or oral form. Written submission — on paper or, increasingly, through electronic judicial document submission systems — is the most common and offers greater legal certainty, since there is reliable evidence of its content and the moment it was submitted.

In situations of extreme urgency, when there is no time to draft a formal written document, the law allows for a verbal application before the court clerk (secretario judicial) of the duty court, who will draw up a record of the application with the essential content provided by the applicant. This option is particularly relevant when acting during night hours or on public holidays, when ordinary document submission channels are not available.

Duty courts, which operate 24 hours a day, 365 days a year, are the natural recipients of habeas corpus applications outside normal business hours. There is no need to wait until the next day or until the regular court opens: the urgency of habeas corpus means that any application must be processed immediately, regardless of when it is submitted.

How Does the Judge Act After Receiving the Application?

Once the application is received, the judge must act with maximum urgency. First, they examine whether the application meets the minimum requirements and whether the facts described, if true, could constitute unlawful detention. If they find that there is a possible unlawfulness worth investigating, they issue an order initiating habeas corpus proceedings and take the necessary measures to have the detainee brought before them.

The judge may require the authority holding the detainee in custody to present them at the court immediately, or may personally attend the place of detention if circumstances require it. In any case, the objective is for the judge to see the detainee, hear their account and that of the detaining authority, and form a view on the lawfulness of the deprivation of liberty.

Once the detainee is before the judge, the latter briefly hears both the detainee and their lawyer and the representatives of the authority that carried out the detention. This is not a full oral trial with the taking of evidence: it is a summary, rapid hearing aimed at obtaining the information necessary to decide on the lawfulness of the detention. After hearing the parties, the judge issues a ruling.

The Judge's Ruling: Two Possible Outcomes

Upholding the Application: The Detention Is Unlawful

If the judge concludes that the detention is unlawful on the basis of any of the grounds provided by law, they order the immediate release of the detainee. This order must be executed on the spot, without any delay. The authority holding the detainee cannot resist or put forward reasons not to comply with the ruling: failure to comply with a judicial habeas corpus order is in itself a criminal offence.

Upholding the habeas corpus does not mean that the criminal proceedings end or that the detainee is acquitted. It means solely that that particular detention was unlawful and must cease. Criminal proceedings may continue, and the suspect may subsequently be summoned before the judge. However, any future action must scrupulously respect their rights, under penalty of a fresh challenge.

In addition to ordering release, the judge may declare void any actions taken during the unlawful detention, including statements obtained in those circumstances. This declaration of nullity can have a very significant impact on subsequent criminal proceedings, by excluding irregularly obtained evidence from the case.

Dismissing the Application: The Detention Is Lawful

If the judge considers that the detention complies with the legal requirements, they dismiss the application and the detainee remains deprived of liberty. The habeas corpus procedure concludes without any liberatory effect, although the dismissal order may be appealed if the applicant considers that the judge has erred in their assessment.

The dismissal of habeas corpus does not close all avenues. The lawyer may continue to challenge the detention through other means: applying for provisional release before the investigating judge, lodging an appeal against the remand order before the Provincial Court, or, if fundamental rights have been violated, ultimately turning to the Constitutional Court (Tribunal Constitucional) by way of an amparo appeal.

The Importance of Acting With a Criminal Lawyer

Although the law does not require the involvement of a lawyer to apply for habeas corpus, having specialised legal assistance makes a real difference to the effectiveness of the procedure. A criminal lawyer with experience in detention situations knows how to quickly identify whether the grounds for habeas corpus are met, knows which competent court the application must be directed to, knows how to draft the written request to maximise its impact, and can act with the speed the situation requires even during night hours or on public holidays.

Furthermore, if the habeas corpus is upheld and release is ordered, the lawyer must be present to manage the immediately subsequent steps: verifying that the release is carried out without delay, documenting the irregularities committed during the detention for later use in criminal proceedings, and advising the client on how to act in the hours and days that follow.

In law firms committed to defending their clients, availability to act in urgent detention cases is an essential part of the service. If you have a family member detained or if you believe a detention is unlawful, do not wait until the next day or until the regular court opens: act now, with a professional who knows exactly what to do.

Frequently Asked Questions

Are court fees required to submit a habeas corpus application? No. Habeas corpus proceedings are exempt from court fees. Access is completely free from the perspective of procedural costs, which ensures that the applicant's financial situation is not an obstacle to activating this mechanism for the protection of liberty. The only costs that may arise are the lawyer's fees if legal assistance is engaged — which, while not mandatory, is highly recommended to maximise the chances of success.

Can habeas corpus be applied for in the middle of the night or at the weekend? Yes, and in fact it is frequently necessary to do so, as detentions can occur at any time. Duty courts operate continuously, 24 hours a day, 7 days a week, precisely to guarantee judicial oversight of detentions at any time. The application may be submitted verbally before the duty court clerk, who will draw up a record and activate the procedure with the appropriate urgency. There is no need to wait for the regular court to open.

What should I do if I do not know which police station my family member is being held at? If the detainee's whereabouts are unknown, the habeas corpus application may be filed before the court of the place where the detention occurred or before the court of the applicant's place of residence, expressly stating that the detainee's whereabouts are unknown. This situation — detention at an unknown location — is in itself a ground that may support the habeas corpus application. The judge, upon receiving the application, may require the security forces to report on the detainee's whereabouts and take the necessary measures to locate them. In parallel, the Bar Association (Colegio de Abogados) may be contacted for information, as may the duty court in the areas where the detention is believed to have taken place.

Can habeas corpus be applied for if the detainee has already been brought before a judge? Once the detainee has been brought before a judge and the judge has ruled on their situation — ordering provisional release or remanding them in custody — habeas corpus loses its purpose, because the police deprivation of liberty has ceased or has been replaced by a judicial precautionary measure. In that case, the appropriate mechanism to challenge the deprivation of liberty is not habeas corpus but an appeal against the remand order before the Provincial Court. If, on the other hand, the detainee has been held for more than 72 hours without being brought before a judge, habeas corpus is the appropriate course of action.

What should the lawyer do if the police do not comply with the judicial order granting release? If the police refuse to execute or delay the compliance with the judicial order for release, the lawyer must immediately inform the judge who issued the ruling, so that they may take the necessary measures to ensure compliance. Failure to comply with a judicial habeas corpus order constitutes the criminal offence of serious disobedience to judicial authority, and the judge may take coercive measures — including the arrest of the responsible officers — to ensure that their ruling is carried out. In extreme cases, recourse may also be had to the Constitutional Court by way of an urgent amparo appeal to obtain immediate enforcement.

Article Tags:

Trending Articles

The Family Law Loophole That Lets Sex Offenders Parent Kids


by Bryan Driscoll

Is the state's surrogacy framework putting children at risk?

family law surrogacy adoption headline

Unenforceable HOA Rules: What Homeowners Can Do About Illegal HOA Actions


by Bryan Driscoll

Not every HOA rule is legal. Learn how to recognize and fight unenforceable HOA rules that overstep the law.

Wooden model houses connected together representing homeowners associations

Best Lawyers 2026: Discover the Honorees in Brazil, Mexico, Portugal, South Africa and Spain


by Jamilla Tabbara

A growing international network of recognized legal professionals.

Map highlighting the 2026 Best Lawyers honorees across Brazil, Mexico, Portugal, South Africa and Sp

Holiday Pay Explained: Federal Rules and Employer Policies


by Bryan Driscoll

Understand how paid holidays work, when employers must follow their policies and when legal guidance may be necessary.

Stack of money wrapped in a festive bow, symbolizing holiday pay

Can a Green Card Be Revoked?


by Bryan Driscoll

Revocation requires a legal basis, notice and the chance to respond before status can be taken away.

Close-up of a U.S. Permanent Resident Card showing the text 'PERMANENT RESIDENT'

New Texas Family Laws Transform Navigating Divorce, Custody


by Bryan Driscoll

Reforms are sweeping, philosophically distinct and designed to change the way families operate.

definition of family headline

US Tariff Uncertainty Throws Canada Into Legal Purgatory


by Bryan Driscoll

The message is clear: There is no returning to pre-2025 normalcy.

US Tariff Uncertainty Throws Canada Into Legal Purgatory headline

How Far Back Can the IRS Audit You?


by Bryan Driscoll

Clear answers on IRS statutes of limitations, recordkeeping and what to do if you are under review.

Gloved hand holding a spread of one-hundred-dollar bills near an IRS tax document

The 2026 Best Lawyers Awards in Chile, Colombia and Puerto Rico


by Jamilla Tabbara

The region’s most highly regarded lawyers.

Map highlighting Chile, Colombia and Puerto Rico for the 2026 Best Lawyers Awards

Can You File Bankruptcy on Credit Cards


by Bryan Driscoll

Understanding your options for relief from overwhelming debt.

Red credit card on point-of-sale terminal representing credit card debt

Uber’s Staged Accidents Lawsuit a Signal Flare for Future of Fraud Litigation


by Bryan Driscoll

Civil RICO is no longer niche, and corporate defendants are no longer content to play defense.

Uber staged car crash headline

Anthropic Class Action a Warning Shot for AI Industry


by Bryan Driscoll

The signal is clear: Courts, not Congress, are writing the first rules of AI.

authors vs anthropic ai lawsuit headline

How to Get Full Custody of a Child


by Bryan Driscoll

Learn the legal steps, required evidence and common misconceptions about full custody to protect your parental rights.

Child holding hands with two parents, symbolizing custody

How AI Is Changing the Way Clients Find Lawyers


by Jamilla Tabbara

Best Lawyers CEO Phil Greer explains how AI-driven search tools are reshaping legal marketing and why credibility markers matter.

AI chat bubble icon with stars representing artificial intelligence transforming client-lawyer conne

Canadian Firms Explore AI, But Few Fully Embrace the Shift


by David L. Brown

BLF survey reveals caution despite momentum.

Canadian Firms Explore AI, But Few Fully Embrace the Shift headline

Colorado’s 2026 Water Rights Battles


by Bryan Driscoll

A new era of conflict begins.

Colorado Water Rights 2026: A New Era of Conflict headline