When someone enters pre-trial detention, the first question is always the same: until when? The uncertainty about the length of the deprivation of liberty before trial is one of its most distressing aspects. The Spanish legal system sets precise and binding maximum terms that the judge cannot exceed.
It is worth starting from a principle: pre-trial detention must last only the time strictly indispensable to achieve the aims that justify it. The judge cannot keep it in place until the maximum term runs out if the grounds have disappeared earlier: if it was ordered for risk of flight and that risk disappears, or for risk of destruction of evidence and that evidence is already secured, the measure must be lifted. This principle is not always applied ex officio: the defence must actively request it, periodically reviewing whether the circumstances still hold.
The maximum terms vary according to the seriousness of the offence. When the anticipated sentence does not exceed three years, pre-trial detention cannot last more than one year; when the sentence exceeds three years, it can last up to two years. The term is counted from the actual entry into the penitentiary facility, not from the order that decrees it; the time of prior police custody does not count within it.
When the initial term is close to expiring and the proceedings have not concluded, the judge can ask the Provincial Court for an extension, always reasoned. In offences with a sentence not exceeding three years, the extension can add up to six months, placing the maximum at a year and a half. In more serious offences, it can add up to two further years, reaching a maximum of four years, but only in defined circumstances: when the suspect has caused the delay or when the case is one of particular complexity.
There is also an absolute and insurmountable limit: pre-trial detention can never last longer than the maximum sentence anticipated for the offence, because the precautionary measure cannot be more burdensome than the very consequence of the offence. The calculation is made in calendar days, continuously, and the time elapsed while the appeal is being resolved is also deducted from the maximum term.
When the term is exhausted, the suspect must be released immediately and unconditionally; the proceedings continue, but with the defendant at liberty. If they are not released, the deprivation becomes unlawful and habeas corpus is available. The law also requires a periodic ex officio review when the detention exceeds one year, without this preventing the defence from requesting release at any time. Several factors can shorten the detention before the terms run out: the provision of bail, the disappearance of the grounds that justified it, the holding of the oral trial, or the success of the appeal.
Finally, time in pre-trial detention is not lost even if there is a conviction: it is credited in full towards the sentence automatically. Someone who has spent eighteen months in pre-trial detention and is sentenced to four years will only serve two and a half years more. And if the defendant is acquitted after a long period of pre-trial detention, they are entitled to compensation from the State for the harm suffered.