Spain on Tuesday arrested two men, one of Algerian and the other of Moroccan origin, who it said had links to Al-Qaeda militants in Mali.
The interior ministry said the two had a "similar profile" to the suspects in the bombings at the Boston Marathon -- though a judicial official said they had no concrete links to the US attacks.
The men, arrested in different parts of the country, were "suspected members of a radical cell related to the terrorist organisation AQIM," Al-Qaeda in the Islamic Maghreb (AQIM), which has carried out attacks and kidnappings across north Africa, the ministry said.
It said the Algerian, identified as Nou Mediouni, 23, and the Moroccan, Hassan El Jaaouani, 52, had "profiles" like those of the two men of Chechen origin living in the United States who are suspected of carrying out the deadly bombings last week in Boston.
Interior Minister Jorge Fernandez-Diaz said Mediouni and El Jaaouani resembled the Boston suspects in that they appeared to be "lone wolves" -- individuals who became radicalised despite not having previous links to organised groups.
A judicial source who asked not to be named said the two had no known concrete links to the US bombings.
The interior ministry said Mediouni was arrested in Spain's northern city of Zaragoza and Jaaouani in the southeastern city of Murcia after a year-long operation with the help of French and Moroccan police.
The ministry said Mediouni was highly radicalised and was believed to have been recruited by Mali-based AQIM members via an online militant forum.
The network instructed him to travel to a "jihadi training camp" run by AQIM in northern Mali.
His trip fell through when he was prevented from contacting AQIM due to security measures in Mali, where French and African forces have driven Islamist militants from their strongholds over recent months.
Mediouni returned to Spain "highly frustrated at not having been able to 'die like a martyr' as he had wished," the ministry said.
It said El Jaaouani meanwhile had also been in contact with Mali-based AQIM leaders, one of whom was "directly linked" with the kidnapping and killing of two French nationals in Niger in 2011.
The ministry said the Mali-based militants "carried out the recruitment of the candidates with the most radical profiles, directing them gradually towards more and more private online forums with strict security measures".
The judicial source said the two suspects would go before a judge at the National Court in Madrid on Thursday.
Police were searching the suspects' homes, the ministry said.
It said 13 people had been arrested in Spain for "international terrorism" since the current conservative government took office at the end of 2011.
Police in February arrested a 22-year-old Moroccan, Mohamed Echaabi, in Valencia for allegedly plotting terrorist attacks in Spain and elsewhere in Europe.
In August, they arrested two Chechens and a Turk, suspected Al-Qaeda members thought to have been planning an attack in Spain or elsewhere in Europe.
On March 11, 2004, Spain suffered one of Europe's worst terror attacks when explosions linked to Al-Qaeda killed 191 people on packed commuter trains in Madrid.
Twenty-one people, mostly Moroccans, were convicted of involvement in those attacks.