A toxic combination of history politics and social tension makes Spain fertile ground for extremist recruitment
The carnage in Barcelona and the shooting of five terrorists in the coastal town of Cambrils 75 miles away are not the first time Spain has found itself victim to jihadist terrorism.
The fact that there was a 13-year gap between these incidents and the Madrid train bombings of March 11 2004 – should not be interpreted as a loss of interest on their part in such a strategic target.
Indeed only the diligence and efficiency (admittedly, coupled with strokes of fortune) of the country's security and intelligence services have prevented further attacks.
According to government sources, some 180 jihadists were arrested in the four years leading up to July 2016. Meanwhile, interventions by law enforcement agencies, with investigative skills honed by decades of experience in fighting terrorism by Basque separatists, are believed to have directly prevented at least 15 major attacks since 2011.
Not all the plots were typical. One that was thwarted in 2011 aimed to poison water supplies in tourist campsites and resorts with chemicals. This was apparently in response to the death of Osama bin Laden.
Searches of the homes of suspects arrested during operations uncovered encrypted videos with detailed maps of major Spanish cities, photos and plans of key buildings and guides to handling explosives.
According to the El Mundo newspaper, the jihadist ranks fighting in Syria currently include more than 100 fighters of Spanish nationality or former residents of Spain. These are among the most fanatical members of the terrorist groups and their active calls to strike in Spain serve as inspiration for followers still in the country.
A key target
Such vast potential is not lost on organisations such as Islamic State, which has claimed responsibility for the Barcelona attack. The group is known to be keen to extend its theatre of operations beyond Syria and Iraq to demonstrate that it is not a spent force. And, equally important, it wants to prompt a public opinion-driven rethink of support by Western governments for anti-IS campaigns.
Spain was mentioned 24 times in jihadist videos, newsletters and other forms of online propaganda over a period of just five months in 2016. That's a reliable indicator that the Iberian country is firmly fixed in the terrorists' sights.
There are geopolitical reasons for this keen and permanent interest. Spain has long been an active ally of the United States – particularly while conservative governments are in office as at present. For jihadists, the country is a key member of the international military coalition that "occupies" Muslim lands.
The picture of the Spanish premier of the day, José María Aznar, standing shoulder to shoulder with George Bush and Tony Blair in the Azores in March 2003 – effectively sealing the pact which led to the invasion of Iraq – served to establish Spain further as an enemy of Islam in terrorist' minds.
Less than a year later, Aznar was ousted from office due to the political fallout from the Madrid train bombings. His successor, José Luis Rodríguez Zapatero, immediately announced he was pulling Spanish troops out of Iraq. Al-Qaeda was swift to highlight this cause-and-effect sequence in subsequent propaganda.
The Spanish government has adopted a less active stance in the Middle East recently. It has refused to join airstrikes in countries such as Syria, for example. However, the government does not criticise its allies in their endeavours, so jihadists continue to see Spain as a legitimate target.
Various historical issues aggravate the threat posed by such groups. It is important to recall that a priority of jihadist ideology is the reinstatement of the original borders of the Caliphate. Spain is considered the illegitimate occupant of Al Andalus (Islamic Iberia), the medieval territory under Muslim control and cultural influence between 711 and 1492. The reconquest of Granada – the last Islamic stronghold in Spain – by the Catholic Monarchs led to forced conversions and mass expulsions of Muslims.
A number of references in jihadist propaganda to Spain emphasise that the country is part of the umma (the supranational community of Islamic peoples), despite it having been seized by "infidels". The territorial claims are wholly unrealistic today, but nonetheless strike a useful chord among radicalised jihadists desperate for a cause in which to believe.
The government is also often criticised for its permissiveness towards the formation of immigrant ghettos. Many fear that these socially excluded areas provide fertile ground for the seeds of the discontent that feeds radicalism and extremism, making young people easy prey for the ideology of jihadist terrorism.
Spain's history, both in its recent and more distant past, makes it particularly vulnerable to jihadist terrorism, which is why these terrible events are unlikely to have come as a surprise. While none of this legitimises the ideology espoused by Islamic State, it goes some way to explaining how the organisation operates and how it convinces followers that cities like Barcelona should be targets of their violence.