Horrific events like the Barcelona and Cambrils terror attacks now seem horribly familiar in the west (though worse examples are regular occurrences in the global south). But this time there was one unusual, and overlooked, factor: the territory that was targeted is the focus of a national dispute that could lead to secession.

Splits in Catalonia's pro-independence campaign before key vote Read more

Escalating tensions between the Spanish and Catalan governments over the latter’s “process” to create an independent republic are one reason why few people have adopted the national Spanish flag to exhibit solidarity with the recent victims – halting the pattern popularised in France after the assaults of 2015-16.

A referendum on independence has been called for 1 October by the Catalan parliament – fulfilling a pledge made by a majority of Catalan MPs. Despite Catalan wishes, the referendum will be unilateral; the Spanish government has vehemently opposed a bilateral vote, and it has also been prohibited by the courts.

This has caused much resentment: over 70% of Catalans back a referendum, and giant pro-sovereignty protests have been held for five successive years. The bitter mood intensified after revelations about the “dirty war” involving collusion between government, fraud officials and the media – and the barring from office of a former Catalan president and three colleagues.

While the roots of Thursday’s attacks lie elsewhere, the Galician writer Suso de Toro has posed the logical question of whether the time and location of the events – all occurring in Catalonia – were chosen to “rip the skin on a graze”. The last major Islamist attacks in Spain coincided with the 2004 general election that followed protests against Spanish support for the Iraq war – and were interpreted as having altered the course of that election.

At the very least, friction over the Catalan vote has shaped responses to the violence on the Ramblas. The police officers praised for killing six terrorists (regardless of whether this was required in all cases) belonged to the Catalan “Mossos”. Madrid had excluded the Mossos from Spanish and international security bodies – including Europol: something now seen as irresponsible, and the decision has been reversed.

The central role of the Mossos in the recent crisis has been received in different ways across Spain. While conservatives complain of Spanish police being “discriminated” against in investigations, other sources have applauded what Toro describes as “a state in practice”. Perhaps this praise is sincere – however grudging. More cynically, it could be calculated to encourage the Mossos to disobey political command and shut down the October poll. Spanish rightists have been agitating for this to happen.

There is a further – encouraging – way in which the grassroots origins of the independence process have surfaced in the past week: the dominant local responses have eschewed a security-centred reaction of the kind adopted by the French state, or the US after 9/11. The cries of “I am not afraid” filling Barcelona’s Plaça de Catalunya last Friday were incompatible with the politics of fear fuelling other conflicts in, and related to, the Muslim world. When a fascist group tried to hold an Islamophobic rally on the Ramblas they were ejected by a larger gathering of anti-fascists and locals. Anti-Muslim hate speech on social media has been overwhelmingly in Spanish, rather than Catalan.

There should be no downplaying of the potential for an Islamophobic backlash – witness the vicious graffiti daubed on mosques in the Catalan towns of Montblanc and Ripoll (as well as Granada and Seville). Yet one factor that could limit it is the liberal atmosphere fostered by an active, and largely leftwing, movement for independence. The progressive mood also benefited greatly from the mass indignados occupations of city squares in 2011, and the surprise victory in Barcelona of a new activist-led coalition in the 2015 municipal elections.

The dignified response of the people of Barcelona to last week’s terror was witnessed across Spain. This has the potential to will help to undermine widely held narratives of Catalan speakers as narrow-minded nationalists. It cannot be ruled out that as a consequence, an authoritarian state response to the referendum will now be politically more complicated.

The Barcelona I know will rise stronger after this day of horror | Francesc Badia i Dalmases Read more

However, some national divisions and related social and democratic questions have resurfaced. Madrid rapidly took steps to reach a new anti-terror agreement with parties from across Spain, and is attempting to turn Saturday’s peace march in Barcelona into a march for Spanish “unity” against a “common enemy” (a territorially limited initiative, bearing in mind that most victims were non-Spaniards).

Conversely, the effect of protests led by the pro-independence and anti-capitalist CUP party has been to relegate the Spanish monarch, King Felipe, and members of the Madrid cabinet from the head of the demonstration – to be replaced by public sector workers who rushed to help the victims. A CUP MP noted that the monarch and government have developed strong economic and personal ties with Gulf states that have funded Isis. “Bravo to the CUP,” was the reaction of one Spanish leftist, and we could add a “bravo” to the Catalan people for showing dignity in the face of adversity. Perhaps ​it really is time they were given the chance to run their own affairs.

• Luke Stobart lectures in political economy at Birkbeck College, London. He writes on new politics in Spain, and migration in Catalonia and Europe. He has participated in the Indignados movement in Barcelona.