The British Labour Party and its party leader, Jeremy Corbyn, didn’t win yesterday’s snap election called last April 18 by Conservative Prime Minister Theresa May, but it was still a historic victory for Corbyn, the British left and for the concept of socialist revolution in a democratic society.

From the time Corbyn, a long-time hard-left anti-militarism back-bencher and protege of the late Tony Benn, was elevated to the leadership position of the Labour Party back in September 2015, he has had (like Bernie Sanders in the US last year) to combat a concerted effort to unseat him by the Labour Party establishment. Only last year, 172 elected Labour Party members of Parliament (that was out of a total of 204) cast a vote of no confidence that forced Corbyn into a party leadership election which he resoundingly won with over 60% of the votes of dues-paying party members.

When May, back in April, at a time when polls showed her trouncing Labour by a 20-25% margin, called a snap election for June 8 (after earlier promising that she would not do such a thing), the Labour establishment figured it would turn out a disaster and finish off Corbyn as party leader. Seven leading Labour MP’s even announced that they weren’t going to run for re-election on a ticket headed by Corbyn, with several even saying publicly that they preferred May to Corbyn. Virtually the entire British news media, from the BBC on down, piled on, deriding Corbyn as a ‘70s relic out of touch with British voters.

At first, amid all that Corbyn bashing, it did seem as though the contest would be a historic wipe-out for the Labour party which was already on its knees following an embarrassing performance in the 2015 electoral outing which left Conservatives with a 343-vote majority (17 more than needed to form a government), and Labor looking like it might be down for good. But then Corbyn, who came out with a truly socialist manifesto calling for improved funding for the gutted and struggling National Health System, an end to tuition for college and university, a major campaign of building more public housing, better funding for public education, and, most importantly, an end to reflexive British support for America’s endless and ever expanding global War on Terror, something started to happen. Suddenly his poll numbers turned around dramatically, and as the days until June 8 voting ticked off, the margin between Labour and the Tories kept dwindling. Meanwhile, Corbyn’s popularity kept rising, eventually passing Prime Minister May’s numbers in some polls.

Even two brutal terror attacks, in Manchester and then in London, failed to significantly dent Corbyn’s charge — in large part because instead of reflexively hunkering down and supporting more draconian security policies as US politicians of both parties do each time some terror attack happens or some alleged terror plot is “disrupted,” he declared that the attacks proved that “the war on terror has been a failure.” Corbyn also took the offense and denounced his opponent May who, as home secretary of the Conservatives before becoming prime minister had overseen the defunding of 22,000 ordinary police officer positions — roughly a fifth of the country’s police force. “You can’t keep people safe on the cheap,” Corbyn declared on the stump to loud cheering.

On election eve, there were basically two polls. One group of these suggested that Conservatives had rebounded following the terror attacks and that the Tories would win a historic victory, gaining a as much as a 75-seat margin compared to the 17 they’d had going into the election. Then there was one outlier poll which, instead of discounting polls showing young people were overwhelming supporting Corbyn, claimed that all the mostly young people who had come out for Corbyn at his rock-concert-like rallies across the country would, contrary to past experience, actually go to the polls on election day and vote. This outlier poll predicted that Corbyn and Labour would end up at least denying Conservatives a victory, creating a hung parliament, or perhaps even winning a majority or plurality, enabling Corbyn to become prime minister.

In the end Corbyn’s newly reinvigorated Labour Party wasn’t able to produce enough of a voter swing back to Labour the win outright, but Corbyn and his party did manage to deny Conservatives a majority of parliamentary seats. The Conservatives ended up losing 23 seats while Labour picked up 32. It was the biggest come-from-behind win for Labour since Clement Attlee in 1945. It is also a huge win for Corbyn, who is now the unassailable leader of a political party that he has managed to both return to its socialist roots instead of being just a pale liberal imitation of the Conservatives, and to restore Labour as genuine opposition party to be reckoned with instead of just a protest vote vehicle.

Corbyn, getting respect for the first time from the nation’s media, is now calling for May’s resignation and for her replacement as Prime Minister.

What comes next is uncertain. The knives are out for May in the Conservative Party leadership, but that will ignite a bitter struggle between those who think the party needs to move away from its current hard-right stance and those who would prefer to see it become even more of a right-wing party. For the time being, May is fighting to stay on as Prime Minister, after cobbling together a fragile agreement for the support of the Democratic Unionist Party in Northern Ireland, whose 10 MPs give the Conservatives only the narrowest of 4-vote majorities in the new Parliament.

Nobody expects this situation to last. Either May’s coalition will founder on some issue, or some Tory MPs will withdraw support on a vote of confidence, which would mean either Corbyn and Labour could have a shot at trying to forge a governing coalition, or try to govern as a minority government with the tacit support of other parties anxious to keep the Conservatives out of power — or, more probably, there could be yet another election.

Given how Corbyn steadily rose in the polls the longer he ran his old-style whistle-stop rail-based campaign, with Labour gaining support the more people got to know him and his socialist platform, it seems likely that with more time and another campaign, he could well bring Labour back into power with a majority of seats should that happen.

It’s an astonishing reversal of fortune, and also a lesson in the importance of standing up for ordinary people — and against militarism — one that progressives in the US should pay close attention to.