The suspect arrested in connection with church attacks in Spain that killed a verger and wounded a priest was served with a deportation order last June, officials said on Thursday.
The suspect, identified so far only as a 25-year-old Moroccan man, had "no prior criminal or terrorism convictions in Spain or allied countries" and was not under surveillance, an interior ministry spokesman said.
"A deportation procedure was opened in June" but "because it was an administrative procedure... the implementation was not immediate," he said.
Police searched the suspect's home early on Thursday and seized "all his effects" which were being analysed.
Local media reports said he lived close to the two churches which are located near the port in Algeciras in the southern Andalusia region.
The incident occurred on Wednesday evening when a machete-wielding assailant stormed into two churches in Algeciras, killing a verger and badly injuring a priest.
Police arrested the alleged attacker at the scene, with prosecutors opening an investigation into "terrorism".