This election campaign was always likely to end with photos of David Cameron standing on the doorstep of 10 Downing Street. The story had far more twists than anyone can have expected, but it’s ended up at the place where it’s been heading for some time.

Still – quite a ride. The final flurry was the flurriest of all, with Brown’s resignation and the accompanying offer of a deal on PR bouncing the Tories into increasing their competing offer. At the same time, many Labour figures began to panic at the prospect of being shoehorned back into power via a coalition of arguable legitimacy. Some comments here have pointed to Britain’s rich history of unelected prime ministers. The history is indeed there, but I don’t think it’s relevant in the current circumstances. An unelected PM coming to power in a minority coalition in the most hostile media environment a Labour premier has ever faced: that’s an unprecedented formula, one which threatened to crash the party through its core-vote electoral floor.

This is a good result for Labour, indeed it’s arguably the best result they could have had, with one qualification (well, two qualifications, if you include the detail about having lost the election). That is that the subject of the Lib Dems enrages Labour and has the potential to make the party seem at its tribal and sectarian worst. That’s a tendency they’ll need to master if they’re going to win over all those Lib Dem voters whose intention was not to help put the Tories in office and keep them there. Labour’s plan has to be to elect an electable leader, wait for the government to make itself the most unpopular in modern British history – that should take about 18 months to two years – and then hoover up the votes at the next election.

As for the Lib Dems, I imagine about half their voters and activists are feeling physically sick this morning. Let’s hope that referendum on AV feels as if it is worth it. I don’t think Nick Clegg could have played his hand any better, in terms of extracting concessions from the Tories. But his concern must surely be that a. he has permanently alienated a vast segment of his own supporters and b. any moderating effect on Tory actions will benefit David Cameron more than if benefits the Lib Dems. The Lib Dems have wanted power for a long time. As all grown-ups know, more tears are shed over answered prayers.

That moderating effect may be a secret weapon for Cameron in his battle with his own party. A Tory minister once observed that the first three people who speak at a 1922 committee meeting, on any subject, are mad. Those guys are still there, and when they aren’t, they have been replaced by younger versions of themselves. Cameron has two huge battles ahead, one with the deficit and one with elements among his own supporters; I suspect that at times, he’s going to find the first contest the more straightforward.

Speaking for myself, it hasn’t fully sunk in yet that the administration has changed for only the second time in more than 30 years. I’m off to get my GP to write me up for some Prozac.