FOR the past 30 years, the Scottish National Party has argued that Scotland needs independence, above all, because it has been ruled by a succession of Conservative governments for which Scots had not voted. The Yes Scotland campaign mobilised a huge coalition against this alleged denial of democratic rights in the 2014 referendum campaign.

At around 4am on Friday morning, it became clear that the democratic deficit has been reversed. Had it not been for those 12 Tory gains in Scotland, against the run of play, Theresa May would have been reduced to 308 seats and would not have been able to form a government even with the support of the DUP. Scotland had for once helped impose Tory rule on the UK.

Once the Scottish Labour Party got over the shock of actually having gained six seats in Scotland, they realised how to use this against Nicola Sturgeon. “She’s let the Tories back in Scotland,” said an angry Iain Grey, the former Scottish Labour leader. Had it not been for Sturgeon's “obsession with independence”, Labour might now be in office and the Brexit Tories consigned to oblivion.

Mind you, this could be turned back on Labour, because no-one was more obsessed with independence in the 2017 General Election than the Scottish Labour leader, Kezia Dugdale. She talked of little else than indyref2, which only served to drum up support for the Scottish Tories. After all, they are the party of the Union, so why vote for second-best? Had Labour in Scotland shown more confidence in Jeremy Corbyn, and stressed the social agenda rather than the constitution, they might have been celebrating an even more dramatic revival.

But whoever is to blame, the Scottish Tories are back, 20 years after they were wiped out in Scotland in the 1997 general election. They aren't going away again any time soon. Under the capable Ruth Davidson, for whom the phrase “cock-a-hoop” was surely coined, the Scottish Tories are once again a significant political force, returning thumping majorities across Scotland. There is no doubt it was indyref2 wot done it. The furious popular revolt against a second independence referendum, turbocharged by opposition to the EU, brought Scottish Conservatism back to life in their former heartlands in the north-east and the Borders. It is no longer possible to travel to England without passing through Tory territory.

Of course, the SNP still “won” this election in Scotland, in a formal sense. With 35 seats, it returned more MPs than all the unionist parties combined. Back in the 2010 general election, the SNP returned only six MPs. But that is ancient history in the fast-moving world of Scottish politics. This result is a psychological blow as much as a political one. The SNP in Westminster has been decapitated, losing, among its 21 casualties, key figures: the Westminster leader, Angus Robertson, in Moray, and the former SNP leader, Alex Salmond, in Gordon. Looking at the numbers, you wonder how the SNP could have held “natural” Tory seats like Angus and Banff and Buchan for as long as they did.

The true measure of a politician is how they cope – not with success, but with setbacks. A sombre Nicola Sturgeon, in her favourite spot in front of that ornate Bute House mirror, made no attempt to hide her distress at the party's losses. She made clear also that, while indyref2 is not dead in the water, it is certainly going nowhere fast, and that she will have to take time to reflect on what has happened.

It was the First Minister’s decision, under provocation from Theresa May, to call for a second independence referendum. That has led to the SNP’s worst losses for a generation, in numerical terms at least. Sturgeon knew that there was no obvious groundswell of support for independence last March, but she thought “Tory hard Brexit” would bring Scots round to the cause of self-government. She was wrong.

However, while Sturgeon was frank about her loss, Theresa May, in her address in Downing Street on Friday, seemed in a state of almost pathological denial. She proceeded to read much the same speech she'd have made had she won the expected landslide: “What the country needs is certainty ... make a success of Brexit ... keep the nation safe and secure ... no-one will be left behind.” Yet, what this result had delivered was anything but certainty and security.

Theresa May said this General Election was all about her, and her ability to provide “strong and stable” government. She is now the discredited leader, leading a weak and feeble administration, whose only future is to stagger on, zombie-like, until she is quietly disposed of by a disgusted Conservative Party or by a Commons defeat. May called this unnecessary election in order, as she put it, to win a bigger “mandate” for Brexit and to strengthen her hand in Brussels. Her mandate has evaporated, and it is she, not Jeremy Corbyn, who will now, in her own words, go “naked into the debating chamber” on Brexit in a week's time.

The UK Government is now beholden to the hard-faced men and women of the Democratic Unionist Party of Northern Ireland for its democratic legitimacy. One wonders how Ruth Davidson will fare with these “friends and allies”, as Theresa May described them, with their homophobic history and their opposition to same-sex marriage, abortion and environmental policies. The delicate political balance in Northern Ireland could easily be shattered now that one side of the sectarian divide is effectively holding the UK Government to ransom.

Meanwhile, Jeremy Corbyn has become the man of destiny who delivered the biggest single increase in the Labour vote since Clement Attlee. A political outsider, who was disowned by Labour MPs, reviled by the press and condemned by the Conservatives as a terrorist sympathiser, he has won a sensational moral victory. Of course, Labour did not win the General Election, but it came closer than anyone thought possible. One of the more amusing distractions on social media overnight was the succession of newspaper pundits – from Phillip Collins of The Times to the Guardian's Owen Jones – apologising for ever having doubted Jeremy Corbyn.

My own sense was that Corbyn's near victory had striking similarities with the Yes Scotland campaign's near success in the 2014 Scottish independence referendum. Like the indyref, Corbyn sparked a true grassroots political revival, holding the biggest mass meetings, in England at least, since the days of Winston Churchill. Like the Yes campaign, Corbyn Labour was a movement as much as a political party. It went under the radar of the mainstream press, using social media to spread the news, and brought people into active politics who had been disillusioned and alienated. This is exactly what happened in those hectic summer months in 2014.

Hundreds of thousands of young voters turned out for Corbyn as they had for Yes. Stung by the claims, made by commentators like me, that young people tend not to vote, they defied the rain and apathy and exercised their franchise as never before. This is an inflection point. We have been used to seeing UK governments gear policies – like the triple-lock on pensions – to seniors, because they can be relied upon to vote. Now that young people are getting in on the act, perhaps we will see policies such as free university tuition, rent controls and wealth taxes back on the agenda in England.

The SNP insist that they got there first, and that Corbyn Labour is an SNP tribute act. Didn’t his manifesto feature many SNP policies like tuition fees, free school meals and scrapping hospital car parking charges? Well, yes it did. However, political parties don't get credit for what they did in the past, but for what they will do in the future. The SNP manifesto had nothing memorable to offer in reply to Labour's anti-austerity document. Indeed, the Nationalists gave voters precious little reason to vote for them – not even independence, since of course Nicola Sturgeon insisted that this election was not about indyref2 but about defeating the Tories. Well, we saw what happened to that.

The SNP have now to face a revived Tory party in Scotland, but the threat to Nicola Sturgeon is probably greater now from Labour. After 10 years in office, the SNP has lapsed into managerial, centrist, safety-first politics. Some even see similarities between the Scottish Government and New Labour, with its aversion to taxing the rich and businesses. Now a revived, social democratic Labour Party could steal back many of the young idealists who galvanised the Yes Scotland campaign.

In 2017, instead of the Yestivals, wish trees and visions of FutureScotland, we saw Nicola Sturgeon touring the country on high in a helicopter, accompanied by a slight air of Hillary Clinton entitlement. At least, so say her critics. Such is the aversion to dissent in the SNP, little of this discontent with the way the party is being run is likely to surface, but it is undoubtedly there. The former Labour activist, Edinburgh East MP, Tommy Sheppard, alluded to it in his recent campaign for the SNP deputy leadership.

As one of the few big-hitters left in Westminster, capable of handling himself in debate and in Prime Minister's Questions, Sheppard must now be favourite to take over as Westminster leader. If he does, he needs to start a serious debate, not just about the next independence referendum – which is now a very long way off – but about how the SNP refashions its programme to take on the new challenge, not from the Tory right, but from the Labour left.