To win back popular support, it seems that the left only needs to remember that it is, unashamedly, the left.

The shock result of Britain’s general election this week should be a message of hope to the ailing left wing across Europe and the United States. The UK Labour party did not win – the outcome of Thursday’s snap election was a hung parliament, meaning that no party has enough seats to form an overall majority and govern. But against all odds, most commentators and most polls, the party took just over 40 percent of the vote – an impossibly good result and better than has been attained in decades.

The UK Labour party, led from the left by Jeremy Corbyn, had been written off as a political force by many of the country’s political pundits. Corbyn came to Labour’s helm unexpectedly in 2015 after changes to the party rules meant that ordinary members could vote for its leadership. They selected a then 66-year-old candidate, whom conventional wisdom cast as too beardy, too scruffy and too radical. Last summer, he saw down a challenge to his leadership by his own parliamentary party who took a vote of no confidence against him and then took turns to explain to the media why he was not a competent leader.

He has been subjected to constant criticism along these lines, his leadership qualities, his political affiliations and his dress sense all routinely scrutinised and pilloried by politicians and by Britain’s predominantly right-wing press. By the time the ruling Conservative party, under Theresa May, called a snap election six weeks ago, Labour’s political fortunes did not look good: it was 20 percentage points behind in the polls, while Corbyn’s personal ratings were frighteningly low.

His embattled supporters insisted that, once people had a real chance to engage with Corbyn and his politics, those ratings would turn around. And Britain’s six-week election campaign provided the opportunity for that to happen. As Corbyn toured the country, his rallies swelled in numbers, as people were drawn to his integrity, his refusal to attack opponents and, most of all, his message of hope, optimism and the possibility of change.

READ MORE: UK general election – Corbyn, Labour and the unknown

Running a populist left programme, the Labour party tapped into a disillusion and discontent over current politics, perceived as dishonest, disconnected and in the service of the very wealthy. His was also an energetic, innovative and youthful campaign, using social media to drive up enthusiasm and support with video clips and memes that swiftly went viral. It made the left both credible and cool, generating support from rappers, football players, soap stars and celebrities – whose messages and campaigning efforts on behalf of Corbyn also garnered viral shares.

Corbyn's leadership refashioned the party, making it more about democratic socialism, pushing redistributive policies to deal with rampant inequalities, taxing the most-wealthy few to benefit the many.

But at the heart of the campaign were the party’s politics, which under Corbyn’s leadership tacked firmly to the left. Before he came to the helm, the party – like much of the centrist left across Europe – had been in a state of managed decline, bleeding support from its working-class heartlands in England’s north. It was a part of the neoliberal consensus, the “third way” approach of triangulation that had come to dominate the political spectrum, essentially: trust in unfettered free-market capitalism, but throw in some small, lukewarm measures intended to mitigate its ravaging effects on the public.

Corbyn’s leadership refashioned the party, making it more about democratic socialism, pushing redistributive policies to deal with rampant inequalities, taxing the most-wealthy few to benefit the many.

The party’s manifesto, fully costed – to bat away lingering myths over Labour’s mismanagement of the economy – carried this left alternative to politics in its DNA: it was all about major investment in the economy, renationalisation of rail and energy companies, investment in the welfare state, the scrapping of university tuition fees, free school meals, chasing after corporate tax avoiders while raising taxes only for the wealthiest five percent of the population.

READ MORE: ‘In shock’ – Social media reacts to UK election

Confounding the naysayers, it proved popular: a public that has for some time been struggling with stagnating wages, work insecurity, spiralling living costs, unaffordable housing and savage Conservative-party cuts to public services, grabbed this optimistic vision of a kinder, fairer society. Young people, in particular, long-disenfranchised and disempowered by politics, leapt at the chance to vote for a better future: youth turnout surged in this election.

The Labour party seems also to have gained support from those who have not previously voted, as well as from smaller parties, the Greens and the centrist Liberal Democrats. It has regained those swaths of voters that had been disillusioned and economically neglected by the party’s centrist approach.

There were, of course, many more factors to the Labour surge: the Conservative Party ran a terrible campaign, its leader Theresa May exposed as weak and arrogant. She had taken voters for granted and seemed to avoid both the public and the press during her campaign.

The Labour party, along with Momentum, the grassroots organisation of Corbyn supporters, galvanised the party’s 500,000 strong members into taking to the streets, the phones and the internet to campaign for Labour. It was thought that two deadly terror attacks during the campaign – in London and the northern city of Manchester – would have an adverse affect on the fortunes of the Labour party, especially since it’s leader was relentlessly smeared as a terrorist sympathiser. In reality, the party’s principled foreign policy – criticising the government’s arms sales to Saudi Arabia; speaking of the increased threat of terror that came with Britain’s destabilising interventions in the Middle East – was in line with public opinion on such matters. The party also chimed with the public mood in its attacks on Conservative cuts to police numbers, which police chiefs had warned might have an effect on security.

OPINION: Corbyn was right in 2003, and he is right again today

For progressives, the Labour party under Corbyn has shown how to regain political relevance. You can’t triangulate hope, integrity and credibility and you don’t need an overwhelmingly right-wing print media to like you. To win back popular support, it seems that the left needs to simply remember that it is, unashamedly, the left.

Rachel Shabi is a journalist and author of Not the Enemy: Israel’s Jews from Arab Lands.

The views expressed in this article are the author’s own and do not necessarily reflect Al Jazeera’s editorial policy.