I only got around to reading Michel Houellebecq’s Submission last month, a darkly amusing book about how France destabilises as it is caught between Islamic and nativist violence. It is, even by French standards, extremely pessimistic, but then who can blame them? When I visited France last summer, I noted just how many heavily armed police there were, even in the obscure western region we were staying at; more than I’d seen in any European country apart from Northern Ireland. The owner of the campsite, who was also a local official, explained that they were expecting something terrible to happen. Which it has done, twice now, this latter atrocity worse in many ways as it involved children.

France’s interior minister has already said France must get used to terror, which some might take as passive fatalism, but could also be realism. After all, ‘we’ are not going to defeat terrorism, not with politics, economics and certainly not tricolor avatars. The terrorism threat across western Europe has been high for some time now, and is unlikely to go away any time soon; personally I’m not sure liberal democracies can survive the existence of even a small minority out to destroy them, so this will be a ‘challenge’, as the Economist might put it.

But since people have had enough of Love, Actually style sentimentality about love conquering hate – which it doesn’t – let’s look honesty at what raises the risk of terrorism, and how to minimise it. Firstly, it’s demography, not the economy. We find that poor economic conditions do not drive participation in ISIS. In contrast, the number of ISIS foreign fighters is positively correlated with a country's GDP per capita and Human Development Index (HDI). In fact, many foreign fighters originate from countries with high levels of economic development, low income inequality, and highly developed political institutions. Other factors that explain the number of ISIS foreign fighters are the size of a country's Muslim population and its ethnic homogeneity. Although we cannot directly determine why people join ISIS, results suggest that the flow of foreign fighters to ISIS is driven not by economic or political conditions but rather by ideology and the difficulty of assimilation into homogeneous Western countries.

Secondly, no system of integration seems to work when there are large numbers of migrants from different cultures involved. Strange to think, but there was once a time when British policy makers considered France’s laïcité something to imitate, but that has been no more successful than our system of handing power over to sinister ‘community leaders’. Indeed the battle between secularism and Islamic identity is not just found in France, but in the killer’s home country, Tunisia, where secularists seem to be winning – thank God – but where as a result large numbers of men are joining Isis.

All in all, America has been the most effective society for assimilating migrants down the years, almost certainly due to its absence of a welfare state – capitalism is the greatest force for liberalism there is – but its Muslim minority is far smaller and more middle class than western Europe’s. On top of this, Chancellor Merkel’s decision to allow in as many as two million refugees has certainly increased the risk of future terror attacks in Europe. Whether some people consider that a reasonable trade-off for saving lives in Syria is another matter.

Finally, and this is where we get into Houellebecq territory, increased hostility to Muslims will make such attacks more likely. The most dangerous thing is that Europe has embedded in it the potential for a positive feedback loop of hatred, since growing Islamic extremism leads to more hostility, Islamophobia and official scrutiny, which most probably leads to further alienation and radicalisation. People think that this loop can simply be stopped or slowed if enough effort is made to silence the Katie Hopkins or Donald Trumps of this world, or the thugs who assault women in headscarves, and by ‘engaging the community’, ignoring the inherent faults in the architecture of our society.

These tragedies can bring about the best in people – heroism and compassion – but they also highlight a tendency towards sentiment and wishful thinking, which is just the sort of behaviour that has caused these problems in the first place.