At 10:01 pm on Thursday, June 8, British left-wing Twitter exploded with delight. The exit polls for the UK’s snap election had just been declared, predicting a hung Parliament. Seven weeks earlier, when Conservative leader Theresa May called the election, her party was polling 20 points ahead. She was expected to win a landslide majority, dominating the country with a narrow, Little England ethno-nationalism. And the Labour Party, under its relentlessly derided left-wing leader Jeremy Corbyn, was going to be wiped off the political map. Or so we were told. Repeatedly.

Instead, Labour did better than the exit-poll predictions, claiming 40 percent of the vote, a level not seen since its postwar peak. The commentators who had told us that lefty Corbyn was disastrous for the party now misread the election result as well. It wasn’t a vote for Corbyn (don’t be silly); it was a vote against May, who had run a terrible campaign, coming across as brittle, robotic, and weak, not “strong and stable” as her slogan claimed. Or actually, people voted Labour expecting it to lose, but wanting to prop up its fortunes a little. Or—by another theory managing to be both obtuse and patronizing—voters, especially the young, picked Labour because it would reverse the country’s referendum decision last summer to leave the European Union. Labour had accepted the result of that referendum. But never mind the facts; why would you assume that voters are this stupid?

Most of Britain’s punditocracy had been deriding, dismissing, and underestimating Jeremy Corbyn ever since he was unexpectedly elected to lead his party two years ago. He was deemed incompetent, while his leftism was viewed as out of touch, unelectable. But then, given the chance to pick him and his socialist policies, an unanticipated 12.9 million did so. It wasn’t enough to defeat the Conservatives, but how did Labour win so many people over, in such little time?

Most of all, the enthusiastic response to the party reflected a previously unmet appetite for left-wing politics. For decades, the UK Labour Party, much like its center-left equivalents in Europe and the United States, had pursued “third way” centrism. Espoused by Bill Clinton and Tony Blair, this was about accepting economic parameters set by the right and letting an unfettered free market do its thing while tinkering at the edges to mitigate its more ravaging effects. Labour’s left, a diminished group at parliamentary level, had long argued that such policies led to desperate economic decline across the party’s traditional industrial base and caused voters to drift away, feeling abandoned by politicians. Between 1997 and 2010, the years when centrist Labour was in power, it lost 5 million votes.

The problem grew more acute after the 2008 economic crash and the swingeing Conservative austerity cuts that followed. With stagnating wages, spiraling living costs, a housing crisis, and a crippled welfare state, the economic strain spread to trouble all but a tiny percentage at the top, who seemed to be doing quite well out of the recession. Labour straggled after the Conservatives—at one point even failing to vote against a bill of welfare cuts certain to plunge more people into poverty. With the parliamentary party so far out of kilter with core Labour values that were still held by its own membership, perhaps the election of leftist outrider Jeremy Corbyn to its helm in 2015 wasn’t such a mystery.

This leftward reclamation meant that for the 2017 election, Labour’s manifesto presented a distinct, hopeful vision in which poverty and inequality were not inevitable: taxing the highest earners to fund benefits for everyone, free school meals, the scrapping of tuition fees, funding for the welfare state. Rejecting a long-held economic myth about the perils of state intervention, Labour committed to investment in infrastructure and renationalization of rail and energy companies. In all, it was a manifesto of big socialist policies that could improve people’s lives and change how Britain was run. It was leaked before its planned release, but even that backfired. A source close to the leadership explains that the leak “did us a favor, as it gave us two bites of cherry”—the chance to dominate two news cycles, that is, when the leaks occurred, and then again at the official release, with discussions on policy details. And the policies were polling highly with the public, despite protestations from the pundits.

The manifesto also gave campaigners tools with which to have a different discussion on the doorstep, at a time when Labour canvassing was also changing. Party membership swelled by some half a million as a result of the Corbyn leadership and a grassroots organization of Corbyn supporters, Momentum, that was set up weeks after his rise to party leadership in 2015. Rebuffing assumptions that they would be little more than armchair activists, new members raised the party’s election game: If the rich-list-funded Conservatives had more campaign money in the bank, Labour simply had more people power. Setting up a phone-banking app, carpools, and a campaigning website, Momentum directed droves of enthusiastic supporters to up-for-grabs marginal seats. With help from activists who had worked on the Bernie Sanders campaign, the group ran nationwide workshops, giving confidence and practical tips to first-time canvassers. And this mobilization worked; dozens of Labour MPs, even those hostile to the leadership, credited this targeted, dedicated campaigning for their success.

These strands combined to create a surge that the polls could not see coming: the energy generated by the Labour campaign, the increased voter registration that would convert into actual votes, the political engagement from sections of the population—young people, nonvoters, returning Labour voters—who had not until this point been offered any good reason to engage.

With broadcast media complying with election rules, Labour’s campaign was premised on the expectation that the public would respond favorably to the previously unpopular Corbyn, once they were given the chance to see him unfiltered by a hostile media. This assumption held—his ratings rose throughout the campaign—because he was perceived as having credibility and integrity at a time when politicians are viewed as dishonest, corrupt, and disconnected. In this context, the TV election debates worked to the Labour leader’s advantage, as it turned out he wasn’t the Britain-hating terrorist sympathizer depicted by the tabloids, but rather had rational politics, which he delivered with clarity and good humor.

Some of the growth in support for Corbyn was also about a consciously populist-left message that broke with politics as usual—a message that resonated for an electorate seeking change. But a lot was also down to his style and tone, with speeches that frequently united disparate social groups in one sentence: pensioners and students, black and white, nurses as well as builders. In a way, this was the true radicalism of Corbyn’s political agenda, which advocates collectivism in the face of competitive individualism, at the same time fusing the party’s Brexit-divided base, which comprises northern working-class and metropolitan middle-class voters.

The momentum for Labour just kept building. Ever-larger rallies for Corbyn made local and national news bulletins, frustrating Conservative campaign HQ while also creating the sense that something significant was taking place. That drove even more cheering crowds to attend his nationwide speeches—because it looked like a political movement that people could be a part of. Both the leadership team and Momentum pushed out short, snappy video clips and memes on social media, readily shareable and inspiring a domino effect of organic, independently produced content.

Official party videos were a departure, too; one, inspired by the Bernie Sanders campaign video “America,” was more like a music video: Soundtracked by Lily Allen’s cover of “Somewhere Only We Know,” it featured a montage of Britain’s “many not the few”—Labour’s campaign slogan—alongside images of Corbyn engaging with people. Endorsements rolled in, from grime and rap artists who said the Labour leadership had inspired them to vote for the first time, to football players and economists—and one from actor and Girls creator Lena Dunham, who mainstreamed a niche leftist meme describing Corbyn as “the absolute boy.”

Weeks before election day, the Labour leader appeared to cheers and one particular chant in front of 20,000 people at a music festival in the north of England. That chant, “Oh Jeremy Corbyn,” to the tune of the White Stripes’ “Seven Nation Army,” took on a life of its own, spawning hundreds of copies and culminating at the Glastonbury Festival last week, where tens of thousands chanted as Corbyn appeared center-stage.

Labour is now in permanent campaign mode, with another election quite likely because of the Conservative government’s shattered credibility and threadbare majority, reliant on support from Northern Ireland’s sectarian, ultra-religious Democratic Unionist Party. British politics is uncharacteristically volatile, post-Brexit, but it looks like the Labour Party managed to tug the country’s political spectrum to the left. What was impossible short weeks ago is now starting to seem unstoppable.