Financial chaos, economic crisis, the likely breakaway of Scotland and possibly Northern Ireland: quite a morning’s work for the Bullingdon Club.

Remember as the pound plunges and the markets slide that this entire referendum was called by David Cameron to fend off Nigel Farage and his own Tory ultras. There was no public outcry for a ballot – but for the sake of a bit of internal party management, he called one anyway. He gambled Britain and Europe’s future to shore up his own position. With all the confidence of a member of the Etonian officer class, he thought he’d win. Instead he has bungled so badly that the fallout will drag on for years, disrupting tens of millions of lives across Europe.

All this from a man who sauntered into the job of prime minister “because I thought I’d be good at it”. He rarely showed any reason for such self-confidence. His plans to modernise the Conservative party crumbled upon first touch with the banking crisis, which forced him and Osborne to reheat the Thatcherite economics they’d imbibed as students. The “big society” turned almost immediately back into the “small state”. At No 10, he launched an austerity drive that was meant to be over within five years, but is now scheduled to go on for double that. Other prime ministers handed power for a long stretch come up with ideas, policies, a style of governing that defines them: Thatcherism, Blairism. What was Cameronism, apart from a hectoring manner at PMQs and an inability to keep on top of detail?

You’ll be reminded endlessly over the next few days how tight this referendum was – that half the country didn’t vote for this. Quite right – and also serious evidence of the weakness of the prime minister. At the last referendum over Britain’s future in Europe, in 1975, Harold Wilson secured a whopping majority. Never a man to ask a question of whose answer he wasn’t absolutely certain, he got a landslide. But when Cameron was handed the full resources of the British state to run this campaign, he still couldn’t count on anything more than a small lead in the polls. A born member of the governing class, he simply wasn’t able to govern.

Not all of this was his creation; much of it is his political inheritance. For the past 40 years, prime minister after prime minister has embraced a regime that has allowed a massive wealth gap to open up between those at the top and the rest of us, that has fattened up central London even while starving other regions of the country – and that has offered the rest of the country elected police chiefs and city mayors instead of an actual voice.

This morning’s results reflect those decades of calculated callousness and the distrust of the political elites they have produced. Thatcher, Blair, Cameron: all pursued an economic inequality – which in turn bred a political and regional polarisation that marked out this referendum campaign. No wonder inner London voted so strongly for the status quo – it’s one of the few places that is doing well out of it. Likewise, it’s no wonder south Wales mutinied, when all the status quo has offered people there for the past four decades is broken promises and rolling immiseration. The shame of it is that all these justified resentments were mobilised by the racists and the hard-rightists. You know things are upside down when the “big merchant banks” are attacked by a former City trader called Nigel Farage.

As prime minister, Cameron had the chance to tackle this toxic mix of inequality and distrust – instead, he made it worse. Leading the remain campaign, he had the chance to address those who had been cut out of the national settlement – instead, he and George Osborne waved around a threat to house prices, even though housing is now this country’s biggest divide between the haves and the have-nots.

In tacit acceptance of his own lack of popular legitimacy, the prime minister invoked the authority of others: the Bank of England governor, Mark Carney; Christine Lagarde at the IMF; the civil servants at the Treasury. Nothing showed up this politician’s own smallness as the technocrats he sheltered behind.

Now he has lost his big gamble and he has lost his job – but it will be the rest of the country that pays the price. He was never that good, he was just cocky. It was never luck, it was just Teflon. And now it’s worn off.