Garvan Walshe is a former national and international security policy adviser to the Conservative Party. He runs Brexit Analytics.

A few disingenuous paragraphs in a speech by Jeremy Corbyn aside, foreign affairs scarcely featured in the election campaign, but the result has serious consequences for national security policy.

A weakened and distracted Prime Minister, never interested in foreign affair,s now confronts a Leader of the Opposition for whom it has been an obsession. She is stuck working with a foreign secretary whose ambitions lie entirely in the domestic sphere and who she has made clear she holds in contempt.

This isolationism chimes with the mood of an inward looking public. His determination to oppose any British military involvement, anywhere, was the only thing that got through to them, but his support for almost any movement opposed to the West will have escaped most of them. That he got paid by Iranian state TV will have been noticed only by a few Middle East obsessives, including this columnist.

Brexit (for the young), school funding (for parents) and social care (for the old) outweigh these matters in voters’ minds.

Surprisingly for an election disrupted by two serious terrorist attacks, serious discussion of terrorist threats, both a revival of dissident republicanism in Northern Ireland and much more organised Islamist violence in Manchester and London, was absent from the campaign.

Aside from the important realisation that fighting terrorism also involves confronting the ideology that motivates its supporters, debate was limited to the simplistic but politically effective Labour assertion that police cuts were to blame for the attacks; matched only by the absurd Conservative line that what was lacking was anti-terrorism legislation.

After seven years of Tory-led government, preceded by 13 years under New Labour not known either for its civil libertarianism or a spartan approach to legislative activity, it is unlikely this is the problem. This is not the Red Army tank corps, where quantity has a quality all of its own.

The difficulties the police and security services face are about priorities – of the 20,000 potential jihadis, who should merit the most attention? Though resources enter into this, it is more about proportionality. Arrests and other security interventions provoke opposition even when they’re well targeted. Acting too early on too many leads can backfire.

The same is true of prosecutions: whether it’s better to swoop early before a plot has got going or wait to accumulate more evidence is a matter of judgement.

The failure to win a majority will save us from having to impose more counterproductive anti-terror laws, of which trying to outlaw encryption is by far the worst. Whether the new parliament permits serious consideration of potentially sensible reforms, such as allowing intercept evidence to be used in terrorism trials, remains to be seen.

What is certain however is that it risks overseeing a severe weakening of Britain’s regional security position. At the end of the Second World War, the United States has made the security of Europe’s democracies and stability in the Middle East and North Africa surrounding it a central aim of its policy. But even before Trump’s election its attention turned towards Asia.

His aggressive hostility to the European Union (I wonder how much of it has to do with Nigel Farage appearing to be his chief adviser on European affairs) has already weakened ties. Leaks by American intelligence (of the investigation into the Manchester attack) and the President himself (of Israeli secrets to the Russians) have put allies on edge.

Just at this point Vladimir Putin, having failed to destabilise France and Germany, has the good fortune to see the rise in one of Europe’s two preeminent military powers of a strongy anti-Western leader of the opposition. So anti-Western, indeed, that he has been paid by Iranian state television, and Seaumas Milne, his confidant, has even attended the Valdai conference of pro-Putin acolytes.

Gerhard Schroeder may have left office, and François Fillon immolated himself in spectacular fashion, but in Corbyn the Kremlin might find a new champion. Better still, Corbyn will help them out of conviction. Unusually for a friend of Moscow these days, the man is utterly incorruptible.

It has therefor become necessary,  whatever the economic relationship that emerges from the Brexit negotiations, to contemplate a strong and structured security partnership with the EU, capable of surviving a Corbyn-led government.

A European security institution, perhaps on the model of a revived and renamed “Western European Union” as suggested by the MEP Charles Tannock, could provide the necessary institutional staying power to resist the depredations that Putin’s useful idiot would wreak upon Western security policy, and supply much needed goodwill to what are looking like very fractious Brexit negotiations.