Under Article 62 of the Aliens Act and Article 2 of the CIE Regulation, no one may be detained without the order or authorisation of the competent Provincial Court (Audiencia Provincial). The judge (Juzgado de Instrucción), after hearing the interested party, decides whether to impose detention by reasoned order, assessing the personal circumstances of the person and the lack of domicile or documentation, and the existence of previous convictions or administrative sanctions and other pending criminal proceedings or administrative proceedings.
Against decisions on detention, the third-country national can lodge appeals of reform, appeal and complaint under the Criminal Procedure Act. Reform and appellation appeals will be lodged before the same judge of the Provincial Court (Audiencia Provincial) that issued the detention order. Conversely, the judicial appeal of complaint would be lodged before the competent High Court (Tribunal Superior de Justicia) within a 2-month time limit.
The judge responsible for monitoring the stay of foreigners in detention centres and in “areas of rejection at borders” will also be the first instance judge of the place they are located in. This judge takes decisions over requests and complaints raised by detainees where they affect their fundamental rights. These decisions may not be appealed. Persons in detention remain available for the judge or court that authorised or ordered the detention.
 Article 62(1) Aliens Act.
 Articles 216 and 219 Code of Criminal Procedure.
 Real decreto de 14 de septiembre de 1882 por el que se aprueba la Ley de Enjuiciamiento Criminal.
 Article 62(6) Aliens Act.
 Article 60(3) Aliens Act.