Angela Merkel's open-door policy towards immigrants fleeing Middle East war zones will, in the long run, make Germany safer from terrorist attacks.
By showing compassion to hundreds of thousands of Muslim refugees, the German Chancellor has sent a message to the world that Germany is not at war with Islam.
More importantly, this means that the vast majority of Muslims resident in Germany have every reason to cooperate with the security services in the fight against terrorism.
This is not something that can be said of the marginalised and radicalised Muslim communities of the run-down suburbs of Brussels or Paris which breed and harbour terrorist networks.
The key to beating terrorism is winning the hearts and minds of Muslims living in the communities that are vulnerable to radicalisation by hate preachers and terror groups like Islamic State and al-Qaeda. So while Merkel's critics have been quick to blame her for the recent attacks in Bavaria it is possible that her actions have already saved the country from the kind of organised mass-murder bomb and gun attacks which have taken place in France and Belgium. These attacks have sprung from the suburbs of Paris and Brussels which have become incubators of terrorism. The hatred and resentment which has taken hold there may take generations to overcome.
Certainly the Paris banlieues and the Molenbeek suburb of Brussels are populated by Muslims who no longer feel they have a stake in mainstream society. Many of the young Muslims brought up there have already headed out to Syria and Iraq to live and fight in the caliphate. Those who have chosen to stay continue to nurse grievances against a state which sends more and more police into their communities to knock down doors and make arrests.
François Hollande has frequently announced that he is at war with Isis. For many Muslims who feel they have become criminalised by their religion the French President might as well be declaring war on them.
The truth is that foreign policy does play a vital role in the radicalisation and incentivisation of terrorists. It is a lesson that France benefitted from during the Iraq war when its government vehemently opposed that conflict. During this period France was free from terrorist attacks, whereas Britain who instigated and waged war against Saddam Hussein, suffered the London bomb attacks of 7/7. Spain too, a high profile supporter of the war, faced the Madrid train bombings in 2004.
Now France and Belgium are being targeted by sophisticated terror operations planned from Syria and Iraq as well as home-grown “lone wolf” jihadis who have been radicalised on the internet. The untrusted French and Belgian security services have been unable to gather vital intelligence from these neglected parts of their cities. This means the intelligence failures that led up to attacks on Charlie Hebdo, the Bataclan, the Brussels transport system and Nice are likely to be repeated.
Critics of Mrs Merkel argue that by announcing an immigration free-for-all she has endangered the lives of ordinary Germans. But the recent flow of refugees from war zones into Europe has not increased the risk of terrorism.
This is supported by the fact that all three asylum seekers who carried out attacks in Germany this week had entered the country long before Mrs Merkel announced her immigration policy last year.
Her open-door immigration approach has done more to protect Germany from terrorism than any counter-terrorism policy because it has helped to reassure Muslims (living inside German borders and jihadis living abroad) that the German government is not at war with Islam. While France and Belgium are caught in a vicious circle of ever-tougher policing and increasing terror attacks, Germany has the chance to forge a different future.
Join our new commenting forum
Join thought-provoking conversations, follow other Independent readers and see their replies