"The threat in Catalonia is clear." With these unflinching words in 2010, made public by the anti-secrecy group WikiLeaks, the US State Department was already voicing concern over the potential for radicalization among young Muslim men in Barcelona.

The city was a "crossroads of worrisome activities," according to the leaked document, with a large Muslim community of which a small portion was vulnerable to being recruited by jihadi groups. Migrants from North Africa, Pakistan and Bangladesh had turned the region into a "magnet for terrorist recruiters," it said.

The day after this week's attacks, Spanish newspapers published numbers illustrating that danger in the form of statistics. Barcelona, along with Madrid and the autonomous Spanish cities of Ceuta and Melilla, has an exceptional number of jihadis. Around a third of Spain's Muslim population lives in these cities. Between 2012 and 2016, 178 jihadis were apprehended in the entire country; almost four-fifths of them came from one of these four cities.

It's no coincidence that so many of Spain's Muslims live in Catalonia. The region's booming economy is hungry for cheap labor, and the government opened a recruitment center in Casablanca in 2003, after some rather unsuccessful attempts to attract workers from Poland. Consequently, more and more Moroccans moved to Catalonia. In 2015, half a million Muslims were living in the autonomous community - around 7 percent of the entire population there.

A minute of silence was observed a day after the Barcelona attack

2013: The turning point

Until 2013 the majority of jihadi suspects detained - 90 percent - were foreigners, mostly migrants born in Morocco, Pakistan and Algeria, according to terrorism researchers Fernando Reinares and Carola Garcia-Calvo. Beginning in 2013, however, they found the situation began to change. Since that year, around half of those detained have been Spanish-born citizens. Most of the arrests occurred in the exclaves of Ceuta and Melilla.

In retrospect, 2013 was a major turning point in two respects. On the one hand, the brutality of the war in Syria had outraged, and eventually radicalized, a portion of young Muslims. On the other, the second generation of young Muslim migrants had started to become adult. Muslim migration is a relatively new phenomenon in Spain, having first begun in the 1990s - so it wasn't until relatively recently that the children of these migrants reached adulthood.

Questionable multiculturalism

The "Generalitat," the autonomous government of Catalonia, extols the multicultural atmosphere of Barcelona, writes the journalist Ignacio Cembrero in his book "The Spain of Allah." In fact, however, it does very little to integrate Muslim immigrants, Cembrero says. According to him, Barcelona is the only major European city without a large mosque. He says proposals to build smaller mosques in the city are regularly rejected, or the city's administration will instead grant permission to construct in less attractive commercial areas. The Generalitat is also dragging its feet on establishing Muslim religious education in schools, he says.

The Mosque-Cathedral of Córdoba is a reminder of Al-Andalus

This is partially because the myth of Al-Andalus, the Muslim kingdom that existed in most of Spain for almost 800 years (711-1492), is still present in the minds of all parties involved. That is one of the reasons that offers to build mosques by the wealthy Gulf States have so far not been accepted. "Spain, including Catalonia, is especially attractive in the eyes of the Arabs," writes Cembrero. "For them, it's not the same investing their petrodollars in building a mosque in Berlin, the city with the largest Muslim presence in Europe, or in Barcelona, which was part of Al-Andalus from 801."

Double identity, double conflict

If many members of the second and third generations of Muslim migrants in Spain find it difficult to resolve the tension between their parents' nationalities and their Spanish identity, and between religion as practiced within the family and the secular environment in which they live, this conflict is made doubly difficult in Catalonia. This autonomous community has its own rivalry with the Spanish government, and the twofold identity this produces makes integration for immigrants even more difficult.

"In Catalonia, we see not only a notable concentration of Salafist movements, but also a society divided by the question of identity," writes the terrorist researcher Fernando Reinares. Many migrants don't know if they should identify as Spaniards or as Catalans, he says.

It's no coincidence, writes Reinares, that in both regions jihadi recruitment activity is above average: For many young migrants, Islamist extremism provides a clearly defined identity that they can't find within the complicated reality of Spain and Catalonia.