The two men, aged 43 and 22, are alleged to have strong links to a cell that recruited, radicalized and trained would-be terrorists for suicide attacks, were arrested on Monday evening just hours before the Manchester Arena attack which has so far claimed 22 lives and left more than 50 injured.
Police said the two men, both Moroccans, are suspected of being “cyber soldiers” involved in more than one hundred internet sites aimed at training Isis members to carry out attacks, including video tutorials on how to make homemade explosions.
In a statement, the National Police said the pair had “become dangerously radicalized” after exposure to “websites and videos designed to train 'inghimasi' – combatants with the knowledge and skills needed to launch attacks in Europe following the modus operandi already seen in attacks in the UK, Germany, Belgium and France.”
Police say the two suspects spent most of their time on their computers at home, rarely went out of the house or mixed socially, but were in constant contact with each other.
Since Spain raised its terror alert to four out of a possible five in the wake of the attack on tourists in Tunisia, it has arrested 164 people with suspected links to Islamic jihadism.
The country has been mentioned on extremist websites as a possible target for historical reasons, since much of its territory was under Muslim rule from 711 to 1492.
But it has been spared major jihadist violence since March 2004, when bombs exploded on commuter trains in Madrid, killing 191 people in an attack claimed by Qaeda-inspired militants.
Unlike France or Belgium, Spain is less exposed to the risk that radicalised citizens who left to fight abroad will return with plans to commit attacks on home soil.
Only around 160 Spaniards are estimated to have joined the Islamic State group in Iraq and Syria, according to a study by the Real Instituto Elcano think tank, compared with over a thousand from nearby France since 2012.