The Tories may still be in power at the end of the night, but Jeremy Corbyn won today.

Yes, I know this is shameless spin, but hear me out: the last few weeks have vindicated the approach of the Labour left and its international cothinkers under Corbyn.

This is the first election Labour has won seats in since 1997, and the party got its largest share of the vote since 2005 — all while closing a twenty-four point deficit. Since Corbyn assumed leadership in late 2015, he has survived attack after attack from his own party, culminating in a failed coup attempt against him. As Labour leader he was unable to rely on his parliamentary colleagues or his party staff. The small team around him was bombarded with hostile internal leaks and misinformation, and an unprecedented media smear campaign.

Every elite interest in the United Kingdom tried to knock down Jeremy Corbyn, but still he stands. He casts a longer shadow over his party’s centrists tonight than at any time since he was elected Labour leader.

Okay, Corbyn may not be prime minister tomorrow. He was a “flawed candidate,” he wasn’t the strongest speaker, he had his share of gaffes, he ate cold beans. All this is true. But besides for outside hostility and the opposition of his own parliamentary group, it’s worth remembering that Corbyn became Labour leader at the most perilous moment since the party’s birth.

Labour was discredited by the Blair-Brown administrations — from their catastrophic military adventures in Iraq to their privatization agenda at home and their overseeing of the financial crisis. The Blairites got their wish: Labour was looking more and more like a social liberal party than a social-democratic one, embracing the financial sector and prepared to “modernize” the welfare state by gutting it. But there was no serious challenge from its left, and there were professional-class voters to chase.

The party’s mass membership base deteriorated, as did its links with a weakened labor movement. Scotland was lost. The only anti-establishment voice in formerly Labour-dominated communities angry at years of neoliberal economic policies was the right-wing UK Independence Party.

This was the situation that Corbyn inherited. Yet against all odds, his team brought Labour back to life.

They rebuilt the party’s mass base, turning Labour into Europe’s largest party, with more than a half million members. Momentum, the grassroots formation created to support the effort, organized tens of thousands in communities across Britain. Battles with the Labour center and right helped in a certain way, too, distancing the leadership from a discredited establishment. Many party members came to embrace the ire of the billionaire press.

Labour developed a robust left character and platform for the first time in decades. Even as it dipped behind in the polls, it was forming the nucleus of a real opposition, a real alternative.

But even if we didn’t care about program and just wanted the Tories out, it’s hard to imagine that a rightward-tacking Labour leader would have done any better than Corbyn. Would Owen Smith have inspired the surge in youth turnout that pushed what should have been a Conservative landslide into a hung parliament? Would Angela Eagle or any “soft-left” challengers have kept Wales in Labour hands? Could any force but the Labour left begin to win back Scotland from the siren-call of the Scottish National Party?

Corbyn salvaged this election by bucking Labour’s conservative slide over the past several decades and sticking to his left-wing guns. His success provides a blueprint for what democratic socialists need to do in the years to come.

Labour’s surge confirms what the Left has long argued: people like an honest defense of public goods. Labour’s manifesto was sweeping — its most socialist in decades. It was a straightforward document, calling for nationalization of key utilities, access to education, housing, and health services for all, and measures to redistribute income from corporations and the rich to ordinary people.

£6.3 billion into primary schools, the protection of pensions, free tuition, public housing construction — it was clear what Labour would do for British workers. The plan was attacked in the press for its old-fashioned simplicity — “for the many, not the few” — but it resonated with popular desires, with a view of fairness that seemed elementary to millions.

The Labour left remembered that you don’t win by tacking to an imaginary center — you win by letting people know you feel their anger and giving them a constructive end to channel it towards. “We demand the full fruits of our labor,” the party’s election video said it all.

If the immediate economic program of Labour was inspiring, the leadership also revived a vision of social-democratic politics that looks beyond capitalism. The most striking thing about Corbynism isn’t that it’s run-of-the-mill welfare capitalism in an era where neoliberalism rules supreme, but that its protagonists see the inherent limits of reforms under capitalism and discuss ideas that aim to expand the scope of democracy and challenge capital’s ownership and control, not just its wealth. What other post-Golden Age, center-left party has drafted plans to expand the cooperative sector, create community-owned enterprises, and restore the state’s control of key sectors of the economy?

The plans were far from exhaustive, but they would put Britain on a course for deeper socialist transformations in the future. That’s a lofty dream, one that will take decades to come to fruition, but it goes far beyond traditional Labourism.

The Labour left isn’t a “mere social-democratic” current. Whereas what social democracy had morphed into by the postwar period often tried to tamp down class conflict in favor of tripartite arrangements with business, labor, and the state, the new social democracy of Corbyn was built on class antagonism and actively encourages movements from below.

But Labour couldn’t just put forward a pie-in-the-sky program. It had to deal with issues that socialists have typically not had to confront. And it succeeded by appealing to the commonsense of “the many” they sought to represent.

When the issue of terror and security was raised during the campaign, Corbyn showed not only that the Left was not weak on these issues — in many ways, we’re more credible than our opponents. For years, it’s been taken for granted that when it comes to terrorism, the choices confronting the Left were either sticking to our hallowed principles and suffering for it electorally, or mimicking the bellicose rhetoric of the Right.

Corbyn found another way through the madness. In the wake of the horrific Manchester and London attacks, the Labour leader was unafraid to connect British imperialism overseas and the proliferation of Islamist terror. Corbyn expanded his criticism into other aspects of British foreign policy: a deep-rooted set of alliances with Gulf States at the center of Middle East reaction.

Corbyn has taken some flak from the far left for his call for a proportional police response to terror. But he outlined a broad alternative, one that spoke of the social causes behind the path to terrorism, and used it to attack the violent xenophobia and scaremongering pushed by the Tories. In doing so, he changed the debate about terrorism in fundamental ways. There will always be alienated, angry people engaging in anti-social activity, but Corbyn offered a way to view such acts as security matters to be dealt with at their roots, rather than a clash of civilizations.

Let’s not underestimate voters. After years of endless wars and violence, most of them are ready for peace. Corbyn offered them what they wanted, and he wasn’t punished for it.

Even with a diminished Conservative majority, things won’t be rosy tomorrow. Momentarily humbled, the Tories still rule. Their allies in the business and media elite will regroup. They will come up with new plans to attack working people and the public good.

But Corbyn’s party is better positioned than any recent Labour regime to be a credible opposition rooted in an unapologetic left vision — to offer hopes and dreams to people, not just fear and diminished expectations. Also, Bernie would have won.