Last week's terrorist attacks in Barcelona and Cambrils were predictable – Spanish security and intelligence officials had recently warned of the likelihood of such an attack. A small but resilient extremist element exists within Spain's large North African diaspora.
Barcelona is the Spanish province with the highest levels of violent Islamist radicalisation. And the country is dangerously exposed to the increasing presence of Islamic State in North Africa.
Spain has been afflicted by successive waves of jihadi activity since the mid-1980s. The Catalan city of Tarragona is believed to have been a key meeting point during the planning of the terrorist attacks in New York on September 11th, 2001.
Al-Qaeda leader and Spanish citizen, Mustafa Setmariam Nasar, the author of the highly influential Global Islamic Resistance Call, lived in Madrid during the 1980s and 1990s (he is currently believed to be a prisoner of the Syrian regime).
Nasar, who also goes by the kunyah (or nomme de guerre) of Abu Musab al-Suri, helped to organise the jihadi cell (mostly North Africans) that carried out the Madrid train bombings of March 11th, 2004.
In 2008, Spain’s police and intelligence services successfully broke up an advanced plot to bomb Barcelona’s metro network. The operation had been planned by members of Tehrik-e-Taliban, a Pakistani terrorist group closely linked to al-Qaeda.
More recently, Spain's security agencies have successfully penetrated a number of terrorist cells linked to Islamic State, arresting close to 200 suspected Islamist terrorists in the last two years. In June, simultaneous arrests were made in Spain, Germany and the UK of suspected terrorists of Moroccan origin.
It is difficult to know at this stage what direct orders or support, if any, the perpetrators of the attacks in Catalonia received from Islamic State or other jihadi networks.
Academic research shows that it is statistically more likely that, as well as drawing upon online materials, the perpetrators of the attacks would have been influenced and radicalised in person, normally by a key charismatic figure from an older generation.
Abdelbaki Es Satty
In the case of this cell, that charismatic older man could have been Abdelbaki Es Satty, a Moroccan national in his 40s who recently set himself up as an imam in the small Catalan town of Ripoli. Es Satty reportedly had links to the jihadi cell that carried out the 2004 Madrid bombings.
Islamic State cells in Europe are merely a new layer on top of pre-existing jihadi networks. For many years, one of the most dangerous of these was the Groupe Islamique Combattant Marocain (GICM), an al-Qaeda linked Moroccan jihadi network that played a critical role in organising terrorist attacks throughout Europe over two decades.
Spain's experiences cannot be understood without reference to those of its near neighbour - Morocco
Individuals linked to GICM have come under increasing pressure in recent years; many have been arrested and convicted of terrorism offences across a range of European countries. But their legacy persists through the enduring radicalisation of younger generations.
In places such as Moelenbeek in Brussels, older jihadi organisers have recruited young men, frequently petty criminals and substance abusers with a scant knowledge of Islam, to fight in Syria and Iraq or carry out attacks in Europe.
Es Satty, despite his proclaimed religious credentials, was convicted of smuggling drugs into mainland Spain from Ceuta in 2010 – his own experiences of crime and deprivation may have allowed him to relate with the young and marginalised among the Moroccan diaspora. Indeed, the Spanish city of Ceuta provides a salutary example of the negative influence jihadi recruiters can have among disaffected young men in the Moroccan diaspora.
Radicalisation in Cueta
Ceuta, along with the city of Melilla, is one of two tiny Spanish enclaves situated on Morocco's northern coast. The city has a population of just under 85,000, with a large Muslim minority (almost 50 per cent and predominantly of Moroccan origin). Despite its small size – mainland Spain has a Muslim population of close to two million – in recent years Ceuta has accounted for 22 per cent of cases of Islamist radicalisation in Spain, just below that of Barcelona, which records the highest.
Ceuta is a culturally disorientating place and one of considerable complexity when it comes to enforcing Spain’s secular laws and respecting the city’s Christian and Muslim communities.
The city has the highest levels of youth unemployment of any Spanish region; criminality is also high, as is educational under-achievement. However, the increased radicalisation of Ceuta's (and Spain's) Muslim youth mirrors that of Morocco itself – Spain's experiences cannot be understood without reference to those of its near neighbour.
Approximately 2,500 Moroccans, including from the wider diaspora in Europe, have travelled to fight with Islamic State in Syria and Iraq. Meanwhile, Moroccan political reforms have stalled; the government in Rabat carefully monitors and exerts control over religious foundations and mosques at home and, to some extent, in Spain.
Radical Islam often appeals to young men disenchanted with their economic prospects in both countries, with a record of criminality and grievance against the police and who are also unconvinced by mainstream religious leaders linked to the state. Recent research indicates that a large number of European jihadis share this background.
Spain is in fire-fighting mode, its security agencies are struggling to intercept an increasing number of terrorist plots. Difficult as that task is, an even greater challenge will be dealing with the causes of radicalisation in Spain.
Two factors were against the Spanish and Catalan authorities last week: the enduring Moroccan and North African jihadi networks that have deep roots in Europe; and the growing presence, financial clout and appeal of Islamic State in North Africa itself.
Europe can only do so much at home; ultimately its security will rest on dealing with the causes of violent Islamist radicalisation in its near abroad.
Dr Edward Burke is a lecturer in Strategic Studies at the University of Portsmouth. From 2006-2010 he was a researcher at the Fundación para las Relaciones Internacionales y el Diálogo Exterior in Madrid