In that moment you could feel British politics lurching out of its rut. Labour was about to pick its next leader – and instead of choosing the favourite, the old Tony Blair tribute act, voters were throwing a giant spanner in the works. They wanted the slightly gawky leftwing underdog. They wanted a transformed party, a bigger politics. They wanted Ed Miliband.

So much has changed this decade that it seems absurd to consider how at its start, in 2010, a 40-year-old father of two and whiz on a Rubik’s Cube was considered the biggest threat to the British establishment. Did that really happen? Yes, confirm the archives. He was Red Ed, a “Marxoid creep” (the Daily Mail, of course), the man with the sneaky plan to turn the country into some socialist banana republic.

One editor congratulated Miliband on his speech, before leaning in: “I’m sorry about all the terrible things we're going to write”

How laughably tinny such jibes sound today. Seen in the rearview mirror of a country hurtling towards a cliff-edge, undeterred by Whitehall warnings of shortages in medicine, fuel and food, the Miliband era looks enviable. You could quarrel and quibble with the man, of course; you could pick holes all day long. But knowing what was to come, how the next couple of episodes were to play out, would you still have gone for the chillaxing blunderer who landed us in a historic mess then grabbed the thick end of a million quid from some poor sap of a publisher to stick his trotters up in a £25,000 shed and yawn out a memoir?

To put it in the argot of those times, which would you prefer: chaos with Ed Miliband or stability and strong government with David Cameron, Theresa May and Boris Johnson? If ideologically you dress to the right, which do you really consider poses a greater threat to the economy: a modest tax on bankers’ bonuses or month upon month of delays and disruption at our ports? Who do you reckon really looks less of a leader: the one who critics dubbed Wallace, or the lying blond clown who styles himself as a latterday Winston Churchill?

I am no nostalgic, and consider counterfactual history the academic discipline of snake-oil salesmen in tweed jackets. But the Miliband period offers serious lessons for today, as we stand on the verge of the kind of tumult few of us have seen in our lifetimes. Our problems at the end of this decade are far larger than they ever were at its start – yet there are echoes. Then as now, we were in rarely visited political territory with a coalition government using a global banking crisis to make historic spending cuts. Just like now, the Tories were hastily trying to paint their Labour opponents as dangerous radicals posing a threat to the British way of life. And this autumn, just as in 2010, the media and civil-society institutions will play a crucial role as arbiters of what is politically permissible. In other words, the treatment dished out to the previous Labour leader was but a dry run for that likely to be doled out to Jeremy Corbyn in the next few weeks.

For his half-decade in charge, Miliband was treated in a way that should embarrass, if not shame, some in politics, the press and business. Disappointed that Labour had chosen “the wrong brother”, some of his own shadow cabinet immediately began whispering poison into the ears of journalists. Having never given him much of a chance, they then threatened a coup. The Tories would greet almost any of his policies by calling him a communist. A cap on energy bills? That, retorted George Osborne, was basically Venezuela. Until, that is, he saw how well the idea was polling.

“I would sit with business leaders who would tell me that a 50p tax on higher incomes was a radical economic risk, that an energy price cap was radical socialism,” recalls Torsten Bell, then head of policy to Miliband and now head of the well-respected economics thinktank the Resolution Foundation. “And I would say: no, it really isn’t. You need to look up the meaning of economic risk.”

Corbyn could have been the nation’s saviour. But he’s just too tribal | Simon Jenkins Read more

When the political class realised the country largely sympathised with Miliband’s ideas they began attacking his physiology. “He doesn’t look like a prime minister,” his own backbenchers would murmur to journalists. Never mind that he’d already amassed more cabinet experience than Blair and Cameron put together when they started in No 10; a real leader had to have rolled off the public-school conveyor belt.

The same tabloids that today are rightly attentive to Labour’s issues with antisemitism spent years splashing on photos of a Jewish man struggling to swallow a bacon sandwich – the subtext of which was never hard to read. The Mail famously conducted hatchet jobs on his dead dad, who’d fled the Holocaust. Even the posh papers would tut over this “north London intellectual”, this rootless cosmopolitan, before just a couple of years later clutching their pearls over May’s line about “citizens of nowhere”. No opportunity was passed up to heap ordure on the man, however unfair. My colleague Rafael Behr records how a political editor went up to the Labour leader and congratulated him on a great speech, before leaning in: “I’m sorry about all the terrible things we are now going to write about you.” In this way, a responsible, thoughtful and decent man was drummed out of frontline politics.

None of this is to excuse the mistakes of the Miliband project: the immigration mugs and the gigantic slabs of limestone and in particular the failure to argue against austerity. But the bottom line is this: Miliband came not to bury capitalism, but to save it. He offered Britain a smidgen of basic social democracy, the smallest taste of redistribution: curbing zero-hours contracts and the vast power imbalance between bosses and workers; the privatisation of natural monopolies and the rotting away of the public realm. By dismissing that argument, the establishment in effect sent out one unified message to voters mired in a slump: that post-crash Britain was unreformed and unreformable. That argument was to be used against the elites with deadly effect in the EU referendum of 2016.

The similarities between Corbyn and Miliband are close, as people in both camps agree. One Labour frontbencher told me recently, “Our 2017 manifesto was basically the programme Miliband would have loved to have presented” – and when I ran that by a senior adviser to the previous Labour leader, they agreed. For all the hard-left epithets flung at today’s opposition, it offers the kind of European social democracy that Angela Merkel would recognise.

I hear about Corbyn the same kind of criticism I heard about Miliband: he’s a weak leader, he’s too radical, he’s too north London. The difference this time around is that the stakes are even higher. Britain is heading fast down the road to economic disaster and far-right extremist politics. One wonders about those who wail at the prospect of a no-deal Brexit and Johnson staying in No 10 yet who also screw up their face at the notion of any compromise with Corbyn’s Labour. Some I remember also treated Miliband with disdain, while a few spent the Blair years urging leftwingers not to let the ideologically perfect be the enemy of the good.

All I’d say is: don’t make the same mistake again. Don’t look at a Labour leader who inevitably comes with his own letdowns and flaws, and choose plummy-vowelled, confident-voiced chaos instead.

• Aditya Chakrabortty is a Guardian columnist