ALL over the world, left-wingers have their faces in their hands. (And by left-wingers, I mean everyone who believes that humans were made to co-operate rather than compete.) A prevailing mass of Americans, not all white and certainly not all poor, have turned to a lying, bullying demagogue who promises "to make America great again".

Correctly, the left understands Trump’s triumph as part of a popular rebellion throughout the world’s "developed economies". But can it ever recover from this disaster? And had the left in fact grown to be part of precisely that "remote liberal elite" which is the target of these rebellions?

We know who is losing these battles. Hillary Clinton, Francois Hollande, the Blairites, Donald Tusk before he left Poland for Brussels, maybe – a worst case – Angela Merkel, and so on. But who is winning? The quick answer is: the far right. Ultra-patriotism, xenophobia, intolerance of all sorts of minority, the wish to stop the world and get off … all these swell chaotic but impassioned political movements which now advance from the fringes.

Some will say: we are in the 1930s again. We are once more seeing populations turn away from trade unions and democratic politics towards nationalist fanatics who want to tear up the treaties, alliances and unions which form our world order. Once more, the demagogues propose huge public infrastructure projects, employing millions and paid for by deficit financing. But Brexit plus Trump doesn’t equal Weimar. And to say "the right is winning" is much too simple.

There were two astounding events in this presidential campaign. One was the election of the Donald. But the other, now almost forgotten, was the achievement of Bernie Sanders. America has changed profoundly if a candidate for the presidency can attract massive support when running as "a socialist". Strictly, he wasn’t one. His politics are "Scandic" social-democrat. But his programme included free college tuition, "medicare" for all, the reform of Wall Street, banning big money from financing politics and a top marginal tax rate of 90 per cent. He gave Clinton a close run for her money in the primaries, scoring 39 per cent of the votes at the Democratic Convention; popular with the white working class, he failed – curiously – to match Clinton’s appeal to black voters,

But in Bernie Sanders’s platform there were planks on which Trump also stood. Sanders, like Trump, perceived a "rigged economy" benefiting only an entrenched, self-satisfied elite. Both men promised to clean out a "corrupt" political system based on that money power. Both were loudly hostile to what Sanders called "disastrous" international trade treaties such as the North American Free Trade Agreement (NAFTA), which they accused of destroying American jobs and lowering wage levels.

Sanders still detests Trump, and refuses to say a word of congratulation. But their campaigns showed that "left" and "right" don’t fit over the division between "the forgotten" and "the Washington elite", which both were exploiting.

Two utterly different women said memorable things on the morning of Trump’s election. One was my old friend Anne Applebaum, a conservative American writer with a rare knowledge of eastern Europe. Unlike the optimists, she believes Trump means what he says. Anne told the BBC that the secure and prosperous world we had lived in had ended. NATO’s guarantee (an attack on one is an attack on all) had been lethally undermined. The globalised free market system, which she considered to underpin peace and democracy, was doomed.

The other woman was Marine le Pen, leader of France’s semi-fascist Front National. She said: "This is not the end of the world. It is the end of a world." And she had a point. A whole mental planet is beginning to break up. The "next world" is pitch darkness – it’s whatever we make of it. But the 30-year obsession with neoliberal, free-market, right-wing economics which began with Reagan-Thatcher, thrilled Europe’s post-communist governments and ran on through Tony Blair to George Osborne, infecting the European Commission and its bankers on the way – that’s over.

The immense social damage done by that doctrine is also the story of the left’s global failure. Sudden economic upheavals create more losers than winners. The socialist movements of Europe had their first base in the urban proletariats created by the Industrial Revolution, later in the wider mass of employees who needed protection against the ravages of unregulated capitalism. But in the later 1980s, the left, at different speeds in different places, began to evacuate this loser territory and migrate rightwards.

And this desertion of the left’s traditional constituency happened just as a new flood of losers – primarily workers in industry and mining – was released by change in that decade. This month’s sensational report by two Sheffield academics, Christina Beatty and Steve Fothergill, shows that Britain has never recovered from the wounds inflicted by Margaret Thatcher’s slaughter of industrial employment. Its colossal cost in benefits, pushing governments into wave after wave of welfare spending cuts, is still creating poverty and hopelessness in Scotland’s central belt or in England’s northeast today.

Than came the collapse of communism in 1989. While liberation empowered and enriched some, it also cast millions who had worked in unprofitable state enterprises into oblivion. But instead of defending them, the remnants of the communist and socialist movements opted for the gleam of the new capitalism. A few years later, Tony Blair led the Labour Party into a privatising compromise with Thatcherism. In Germany, the social democrat Gerhard Schroeder abandoned his party’s working-class tradition and "liberalised" employment laws.

Incredibly, the great crash of 2008-9 produced no ideas for an alternative to these blatantly failed neo-liberal economics – not even in countries where socialist or social-democratic parties were still in power. Instead the crisis led to further deregulation, as the hope of a "steady job" was gradually replaced by the casual gig and the zero-hours contract. In small-town Poland, England outside the Home Counties or rust-belt Indiana, the sense grew that the neo-liberal free-for all had dumped ordinary people on the dark side of a widening wealth chasm.

The place deserted by the left is now being occupied by a new sort of party. Crudely nationalist, authoritarian, intolerant of minorities, these parties none the less claim to defend the "forgotten" and the "little man" by strong state intervention and public spending. In short, they have stolen the left’s old clothes.

The question, then, is whether the left can steal them back again. Europe’s social-democrats and moderate socialists have grown deferential to the bankers and multinationals; they kneel to the cult of balanced budgets, which treats debt and deficit as the sin against the Holy Ghost. Angry plebeian stampedes seeking to "take back control" ignore them as part of the "corrupt liberal elite".

Scotland, an exception, has been lucky. No Trump, le Pen or Geert Wilders diverted Scots who felt misgoverned and

abandoned into the dead-end of right-wing populism. Asking how to "take back control", most Scottish voters found an answer waiting. A decrepit Labour establishment was ripe to be thrust aside. Popular grievance turned positive, pouring into a civic independence movement committed not to xenophobia but to a cautious brand of social democracy.

But this may not last. Unless the SNP leaders drop that caution and go for far more radical change (a total democratic recasting of local government, "power to the people", would make a start), that inrush of grievance will overflow into nastier, less tolerant channels.

With neo-liberalism exposed as the destructive creed it always has been, the left’s way ahead ought to be open. Picking themselves off the ground, surviving left parties should at least to be preaching the managed capitalism, the "social market economy", which multiplied Europe’s equality, security and prosperity a generation ago.

Social democracy isn’t full socialism. But left-wingers face a choice. They can fight as a small, hard-left party, like Die Linke in Germany, which can’t hope for power beyond junior partnership in coalitions. Or they can fight as social-democrats, loudly defending civil rights and minorities while offering a strong, caring, proactive state.

The first option, is the easy one. The second is a steep, stony path back to humane government. The Labour Party, wrongly thought to have retreated into red sectarianism, is actually on that second track. Its leader is hopelessly unconvincing. But the Corbynite programme – hardly more extreme than Tony Blair’s in 1997 – would be a sturdy

barrier against mindless populism.

As the Brexiteer tide ebbs into disillusion, as it must, there’s a danger that vengeful, stab-in-the-back politics will replace it. In England – not in Scotland – that would veer towards an Anglo-fascism, a disaster that would cloud the whole island. If the left is to return to power, it must achieve two things. It must be convincing as it offers the public-interest state to replace the wreckage of laissez-faire economics. And it must lead the battle to defend the rights of an open, diverse society against the new demagogues.

That’s a battle which will take years to win. But it has to start now.