Skip to content

Habeas Corpus: Defence of the Unlawfully Detained

Urgent habeas corpus procedure (Organic Law 6/1984) to challenge unlawful or irregular detentions. Judicial resolution within 24 hours.

Habeas corpus (Organic Law 6/1984) is a summary, urgent procedure to challenge an unlawful detention or one carried out in breach of fundamental rights, in which the judge must rule within 24 hours of the proceeding being opened. It may be requested by the detainee, their spouse or partner, ascendants, descendants or siblings, their legal representative, their defence lawyer (since Organic Law 5/2024), the Public Prosecutor's Office or the Ombudsman, and the judge may open it of their own motion. Typical grounds include detention without legal cause, detention extended beyond 72 hours without being brought before a judge, detention carried out without informing the person of their rights, or denial of access to legal counsel. It is a procedure with no formalities and no cost to the applicant, which our firm activates immediately when it detects irregularities at the time of arrest.

What Is Habeas Corpus

Habeas corpus is the oldest constitutional guarantee for the protection of personal liberty. It is governed by Article 17.4 of the Spanish Constitution and by Organic Law 6/1984 of 24 May. Its purpose is to obtain the immediate placement before the competent judicial authority of any person unlawfully detained, so that the judge verifies the circumstances of the detention and either regularises it or brings it to an end. It is a summary, urgent, free procedure with no formalities: the judge must resolve within a maximum of 24 hours.

Cases of Unlawful Detention

Article 1 of Organic Law 6/1984 lists the cases:

  • Detention without legal cause: without a rational indication of an offence justifying the deprivation of liberty.
  • Detention by an incompetent authority: carried out by someone lacking the power to detain.
  • Prolonged detention: maintained beyond the time strictly necessary or, in any event, beyond 72 hours without release or placement before a judge (Art. 17.2 of the Constitution and Art. 520.1 LECrim); in terrorism cases, the judge may authorise an extension of up to 48 more hours (Art. 520 bis LECrim).
  • Deprivation of liberty with breach of rights: without the reading of rights, without legal assistance, without notification to family or consulate, or in unofficial premises.
  • Committal without the required guarantees: involuntary committals carried out without judicial authorisation.

Procedure and Timeframes

The procedure is extraordinarily swift: (1) Application by simple writ, oral appearance or telegram addressed to the on-duty Investigating Judge. (2) Opening order: the judge decides whether to admit the application. (3) Appearance: the detainee is immediately placed before the judicial authority; the judge hears the detainee, their lawyer, the Public Prosecutor and the officer who carried out the detention. (4) Resolution: within a maximum of 24 hours from the order opening the procedure, by an order ending the procedure.

Who Can Request Habeas Corpus

Standing is extraordinarily broad (Article 3 of Organic Law 6/1984): the detainee; their spouse or a person in an analogous relationship; descendants, ascendants and siblings; for minors, their legal representatives, and for persons with disabilities under judicial support measures, the person providing that support with power of representation; the Public Prosecutor; the Ombudsman; the detainee's defence lawyer (since Organic Law 5/2024); and, of their own motion, the competent judge. No lawyer or court representative is required, although immediate legal assistance speeds up and strengthens the procedure.

Effects and Consequences

If the judge finds the detention unlawful, they may order (Art. 8 LO 6/1984): (a) the immediate release of the detainee; (b) the continuation of the deprivation of liberty in accordance with the law, where necessary in a different facility or under different custody; or (c) the immediate placement of the person before the court if the legal detention period had already expired. Upholding the habeas corpus may also give rise to the criminal liability of the authority or official responsible for the unlawful detention (Arts. 167 and 530 CP).

Penalties & Consequences

Type / ScenarioCriminal Penalty
Unlawful detention (Art. 167 CP)An authority or official who carries out an unlawful detention receives the penalties of Arts. 163 to 166 in their upper half, which may be raised to the next degree (for basic detention, 5 to 9 years' imprisonment), plus absolute disqualification for 8 to 12 years.
Rights violation (Art. 530 CP)Special disqualification from public employment or office for four to eight years for an authority or official who, where there is a criminal case, orders, carries out or prolongs a deprivation of liberty in breach of the time limits or other safeguards.
Patrimonial liabilityCompensation for judicial error or abnormal functioning of Justice Administration (Art. 121 SC).

* Penalties shown are indicative. The actual penalty depends on case circumstances, applicable mitigating and aggravating factors.

Our Defence Strategy

01

Telematic submission

Immediate submission via email to the duty service of the Court of Instance to gain time.

02

Visual documentation

When possible, capture of physical traces and testimonials about detention conditions.

03

Family and consular coordination

We immediately notify family and, if foreigner, corresponding consulate.

04

Action reserve

If detention was unlawful, assessment of criminal actions against authority and patrimonial liability claim.

Criminal Procedure in Spain: Fast Trials, Extraditions & Prison Law — Defence Guide

Beyond substantive criminal offences, Spanish law contains a complex procedural framework that directly affects defence strategy. Fast-track trials (juicios rápidos), extradition procedures (European Arrest Warrants and bilateral treaties), penitentiary law (classification grades, parole, sentence review) and juvenile justice (LO 5/2000) each demand specialised knowledge. Understanding procedural rights and deadlines is often decisive for the outcome of a case.

Key Procedural Frameworks

FrameworkLegal BasisScopeKey Feature
Fast-track trialsArts. 795-803 LECrimOffences punishable by up to 5 years prisonTrial listed within the following 15 days
European Arrest WarrantLaw 23/2014Cross-EU extradition60 days to decide without consent (+30 extension)
Prison classificationLO 1/1979 (LOGP)Classification into grades 1, 2 or 3Open regime (grade 3) = semi-liberty
Conditional releaseArts. 90-93 CPRelease from prison on licenceGrade 3 + ¾ of sentence served + good conduct
Juvenile justiceLO 5/2000Offenders aged 14-17Sanctioning-educational measures, not criminal penalties
Criminal record expungementArt. 136 CPDeletion of criminal recordTimeframe varies by offence severity

Key Defence Strategies

Fast-Trial Conformity Advantage

In fast-track proceedings, agreeing to a plea (conformidad) with the prosecution carries a one-third reduction of the sentence sought. This can make the difference between prison and a suspended sentence.

EAW Refusal Grounds

European Arrest Warrants may be refused on grounds of: ne bis in idem (double jeopardy), time-barred offence, minor's age, or if the person will serve the sentence in Spain. Each ground requires specific procedural challenges.

Prison Grade Review

Inmates may contest their classification grade before the Supervisory Judge (Juez de Vigilancia Penitenciaria). Progression to grade 3 (semi-liberty) requires demonstrating good conduct, personal development and reduced recidivism risk.

Juvenile Diversion

For minor or less serious offences committed without serious violence or intimidation, the Prosecutor may end the file and ask for it to be dismissed (sobreseimiento) if the minor reconciles with the victim or makes reparation (Art. 19 LO 5/2000); the technical team may also propose not continuing it (Art. 27.4). The defence can steer the case towards this outcome, which avoids the hearing and any judgment being entered in the juvenile register.

Key Case Law

Art. 801.2 LECrimFast-trial conformity reduction

In fast-track proceedings, once the duty court has checked that the plea meets the legal requirements, it imposes the sentence sought reduced by one-third, even below the statutory minimum.

CJEU C-404/15EAW and fundamental rights protection

The CJEU held that where there is a real risk of inhuman or degrading treatment because of detention conditions in the issuing State, the executing authority must request supplementary information and postpone its decision on surrender until that risk can be discounted; if it cannot be discounted within a reasonable time, it must decide whether to bring the procedure to an end.

Constitutional Court doctrineRight to prison grade review

The Constitutional Court holds that prison classification decisions must be reasoned and subject to periodic review, in line with the fundamental rights of sentenced persons under Art. 25.2 CE.

Why Choose Us?

Need a criminal defence lawyer for this type of offence? Here's how we work:

Immediate petitionUrgent activation of procedure without need for formalities or waiting for preliminary procedures.
Guarantee verificationOn-site verification of detainee rights compliance at police premises.
Constitutional articulationFoundation in Art. 17 SC and constitutional jurisprudence.
+15 Years of ExperienceTeam dedicated exclusively to criminal law before Spanish courts and tribunals.
Direct AttentionYour case is handled directly by a senior lawyer of the firm.

Need urgent criminal defence?

Contact our specialist criminal defence lawyers. We evaluate your case confidentially.

This page is for information purposes only and does not constitute legal advice: every case requires individual assessment. How this content is produced and verified: editorial policy.

Do you need specialised legal assistance?

The judicial system is complex. We have the criminal-law specialisation and technical resources required to take on the defence.