Commuters walk past floral tributes near the scene of the recent attack at London Bridge and Borough Market in central London, Britain June 7, 2017. REUTERS/Stefan Wermuth Image Credit: REUTERS

The sad truth about the terrorist attacks in Manchester and London is that some violent young men are going to be attempting such atrocities for many years to come. This will not be over in a few months or even years, for the factors driving it are not about to evaporate. Conflict and tension in the Middle East will not be ending any time soon, nor the bitter grievances to which it gives rise.

At the same time, there is set to be a huge rise in the number of young men in that region as part of a rapid rise in population — which means more of them are available to be recruited to a violent cause. The hateful ideas of so-called Daesh (the self-proclaimed Islamic State of Iraq and the Levant) and the corruption of a great religion by violent extremism will also not pass quickly. Such ideas take time to be shown and understood among their intended adherents as fundamentally mistaken — which they will be, but only after many thousands of young lives have been wasted. So it is true that this is “a generational struggle”. Ten, and perhaps 20 years from now, it will still be going on. Winning the battle of ideas against violent ideology is obviously crucial to shortening such a struggle, and the terrible fate of the populations of Raqqa and other areas occupied by Daesh provide plenty of material for that.

Women have been enslaved and subjected to systematic sexual violence, prisoners barbarically executed. The evidence is there for teachers in every school and preachers in every mosque to use to turn hearts and minds against extremism: No moral defence of such actions is possible, in any religion, in any age, according to any ethical framework that has ever enjoyed the widespread support of humanity. There is no excuse for not confronting and no point negotiating with such evil. Encouraging all those with influence over young Muslims to spot signs of danger and disaffection is a necessary part of the fight against that evil, and will have to go on, for all the criticism that the “Prevent” strategy devised under former British prime minister Tony Blair and continued by three prime ministers is singling out particular communities.

British Prime Minister Theresa May has been spot-on to say that there has been too much tolerance of extremist views. The political argument over police numbers is fed by opposition parties who have little else to say about fighting terror. The police response to all the recent attacks has been outstanding and rapid, and the number of armed police officers has been increased.

Police numbers overall only had to be cut because of the unsustainable state of Britain’s finances left behind by former prime minister Gordon Brown. Such arguments distract the public and the media from what really has to be done to save innocent lives. If this indeed is to be a long struggle, the doubt and fear that terrorists are trying to create in the minds of the general public has to be felt by them instead. The risks of discovery have to become greater and the opportunities for a successful attack reduced. There are at least three ways of bringing that about.

First, Britain should not hesitate to take action overseas whenever territory is falling into the hands of groups that sponsor terror in their own country. Britain came late to the international military effort against Daesh in Syria, because the government was not confident earlier of winning a Commons vote on the issue after Labour voted down action against Syrian President Bashar Al Assad in 2013. Even when the vote came in December 2015, Jeremy Corbyn voted against using the Royal Air Force to attack what had become a terrorist state. Next time, Britain should not be among those holding back.

Second, there has to be a way for a free society, defending the lives of its citizens, to gain access to the communications of those plotting to harm and kill them. Social media companies like Facebook have to do their bit, and most of them do seem to have woken up to the scale of the problem of hosting extremist material and are grappling with doing something about it. But the introduction of unbreakable encryption through services such as WhatsApp inevitably takes steadily more communication between would-be criminals out of the reach of intelligence services.

There are powerful arguments for such encryption, which helps to defend individual privacy, stops cyber-attacks and helps those struggling against dictatorships. Yet, technology companies should recognise now that they will have to design messaging apps that allow for some access by law enforcement authorities where it can prevent mass murder in the streets.

Third, human intelligence is required on a scale that leaves any plotter of an outrage wondering just who he is talking to. The British Government has put nearly 2,000 extra officers into the intelligence services to fight terrorism ­— another point to remember when you hear the ludicrous complaints of Labour MPs about resources — and those services do an incredible job, detecting and frustrating the vast majority of plots mounted in the United Kingdom. As ever, they are unsung heroes, criticised when an attack gets through and rarely mentioned when so many do not. In the coming years, Britain will need an increased number of intelligence agents to detect the planning of terror, even to the point of being agent provocateurs who create an atmosphere of mistrust and uncertainty about any plan of attack. Whatever the measures to be taken, they are going to need a tough-minded set of ministers to carry them through.

This election should mainly be about who can get the best deal out of Brexit, to which the answer is Theresa May with a good majority. It should also be about the British economy, which has nearly three million more people in work after seven years of Conservatives being responsible for it. But if it is to be about security, there is equally no doubt about how to vote. The idea of Corbyn as an effective leader of a long-term struggle against a terrorist foe is preposterous. He is not temperamentally or ideologically suited to the ideas I have listed or anything like them. Defeating terror is going to need a prime minister who believes it has to be done, and won’t shrink from doing what is necessary. Britain doesn’t have to look for that PM. It has already got her.

— The Telegraph Group Limited, London, 2017

William Hague is a former foreign secretary and a former leader of the Conservative Party.