David Cameron and the Conservative Party have been returned to government in the UK, with a majority in their own right. The Tories won 331 of the 650 seats on offer, a gain of 28 on their previous 303, while Labour lost 24 seats, falling to 232. The Liberal Democrats had the worst night of it, being demolished, and losing 50 of their 58 seats, with just about all of their frontbench gone, only leader Nick Clegg surviving.

The Scottish National Party had the night that had been widely forecast, winning 56 of the 59 Scottish seats, leaving one only for each of the major parties. UKIP, despite winning 12% of the vote overall, couldn’t turn the vote into seats — they lost one of the two seats they had gained from Tory defections, and gained no others. The Greens held onto their seat in Brighton Pavilion, but gained no others.

Indeed the vote was the usual anomalous process of first-past-the-vote systems. The Tories saw barely a rise in their overall vote, going from 36.1% to 36.9%, while Labour’s vote went from 29% to 30.4%. The Lib-Dems fell catastrophically, from 23% to 8%, and the SNP tripled theirs, from 1.7% to 4.7%.

With the vote came a series of high-profile losses. Douglas Alexander, the Lib-Dem’s former shadow foreign secretary lost his seat to a 20-year-old SNP candidate, Mhairi Black, the youngest MP since the 1600s. Vince Cable, the Lib-Dem who had been business secretary and a vital part of the government, lost his London seat. And mid-Friday morning, the ultimate humiliation — shadow chancellor Ed Balls lost his West Yorkshire to the Tories by a mere 400 votes. Left-wing maverick George Galloway lost his seat in Bradford West to a massive return to Labour.

The result was a departure from all polling over the last six months, both general and constituency-based, which had seen the Tory vote falling to 33-34%, and Labour rising to that figure — even with the loss of a few percent due to the SNP rise. Polls accurately predicted the Lib-Dem collapse, but this was wrongly interpreted by many, who believed that they would retain around 25 of their key “fortress” seats. They didn’t — the vote collapsed across all their seats.

Within an hour late Friday morning, three party leaders had resigned — Ed Miliband, Nick Clegg and finally Nigel Farage of UKIP, who said he was fulfilling a promise to quit if he didn’t win a seat. He then said that he might re-apply for the job after summer, to fill the vacancy he had created, in true UKIP fashion.

The Tory victory is not as it seemed in many respects. They only took seven seats directly from Labour, while Labour took 10 from the Tories. Labour lost another 30 or so to the SNP, but that was a loss to the left, seats Tories couldn’t count on.

It was the collapse of the Lib-Dem vote rightwards that gave David Cameron his victory. They dropped like a stone everywhere — more than half of their candidates lost their deposits. Their regional strongholds in Cornwall and Devon, and the west country are gone, as are their London seats.

With one-party government again, David Cameron moved ahead with a reshuffle to create a fighting cabinet. Michael Gove, the culture warrior education secretary, goes to Justice to eviscerate the Human Rights Act, and introduce mass surveillance. Iain Duncan Smith has been brought back into cabinet to push through 12 billion pounds in welfare cuts. And thus shall it go.

However, though it was a clear political victory by the Tories, and its supporters will rejoice at having got rid of the hated Lib-Dems, it remains a paradoxical and contrary victory. They have gone from a 40-seat majority for government policy, to an eight-seat one. That leaves Cameron exposed to the party right, who loathe him, and to backbench revolt on issues such as civil liberties. A central part of winning the victory was a promise of an “in-out” referendum on EU membership in 2017 (after a renegotiation of terms with the EU), and if Cameron tried to duck that, the party would collapse into turmoil. When the referendum does happen, Tories will be campaigning down both sides of it, and it will be a bitter struggle.

Cameron also has Scotland to deal with straight away. The Scots were promised a “new deal” if they stayed during the referendum — and now Cameron has to honour that promise. But the Scots now count as a virtual second opposition, of a party whose stated aim is to leave the state they’re part of.

Should the EU referendum result in departure, then that will trigger a new referendum in Scotland — one that would be far more likely to end in a “yes” vote. The possibilities for the next five years are momentous: at the end of it, things could be much as they are, or the whole state could have collapsed, leaving an England outside the EU. It is very possible that David Cameron will enter history as the last prime minister of the UK. If so, it will be in part because of the campaign that Cameron et al ran, which all but declared the incoming SNP members to be illegitimate. It’s a measure of the profound ruthlessness of the right that a so-called unionist party would be willing to test the union to destruction with a blistering political rhetoric.

But it’s a ruthlessness that the centre-left could do with getting a bit of. They do for a while, then it goes away again. If anything, Labour’s lacklustre campaign with its micro-pledges and targeted promises, and absence of attack, has been shown, once and for all, to be something that you just can’t do. By now, the post-mortems have started, with New Labour damning Miliband’s mild move to the left. That may be, though Labour faced a deeper challenge — and even with the SNP surge — Labour increased its vote. That wasn’t enough, and a different campaign and a different leader might have won it, but the current versions of both are suffering from heightened expectations. It’s difficult to defeat a first-term government, but for more than a year that has looked very possible. It didn’t turn out to be, but Ed Miliband has paid the price and so will Labour, in the first instance. There will be a bloodletting, a call for policy renewal, a failure of it, and on we go. Yet though he is having the triumph now, the challenges ahead will all be David Cameron’s.