Unlike many of us, Bernie Sanders never doubted Jeremy Corbyn. The week before the general election, the independent US senator from Vermont was addressing a crowd of progressive voters in Brighton during a whirlwind tour of the UK. An audience member asked him what advice he might have for the leader of the Labour Party. “I don’t think Jeremy Corbyn needs my advice,” Sanders replied. “I think he’s doing quite well.”

The week after the election, a delighted Sanders invoked Corbyn’s election performance in a New York Times op-ed. “The British elections should be a lesson for the Democratic Party,” he wrote, urging the Democrats to stop holding on to an “overly cautious, centrist ideology” and explaining how “momentum shifted to Labour after it released a very progressive manifesto that generated much enthusiasm among young people and workers”.

Sanders and his growing movement in the United States offered more than mere rhetorical support for Corbyn.

With the help of former members of the senator’s presidential campaign team, Momentum – the grass-roots organisation set up to support and defend Corbyn in 2015 – ran 33 training sessions across the UK, preparing thousands of Labour activists.

Momentum’s national organiser Emma Rees says that the Sanders people made a “significant contribution” to the Labour campaign with their emphasis “on having empathetic conversations that focused on the issues the voter cared about, and actually trying to persuade voters on the doorstep rather than just collecting data”.

“In the final stage, I recruited a bunch of former Bernie volunteers from around [the United States] to . . . help get out a last [get out the vote] texting assignment,” recalls Claire Sandberg, who was the digital organising director for Sanders and spent the 2017 election campaign working with Momentum in the UK. “It was an amazing thing to see them volunteering . . . while we were all asleep the night before election day.”

Is it really surprising that Sanders supporters, thousands of miles away, would want to volunteer for Corbyn? Both men are mavericks; both have a certain authenticity and unpretentiousness that their rivals lack; both, in the words of Emma Rees, “have inspired tens of thousands of people to participate in the political process and to realise their collective power” and they want “to transform society in the interests of ordinary people”. Perhaps above all else, both men have proved that left populism can win millions of votes.

According to the latest polls, if another election were held in the UK tomorrow, Corbyn would be the winner. Sanders, however, has a much higher mountain to climb in the US and faces at least three obstacles that the “British Bernie” does not.

First, Sanders leads a growing grass-roots movement but does not have the support of a party machine and infrastructure.

Corbyn may have been a backbench rebel who voted against his party whip more than 500 times before becoming party leader, but he is a lifelong Labour member.

Sanders, on the other hand, is the longest-serving independent politician in US congressional history. He declared himself a Democrat in 2015 only in order to seek the party’s presidential nomination and promptly declared himself an independent again after he was defeated by Hillary Clinton last summer.

Such behaviour has allowed establishment Democrats to portray him (wrongly) as an opportunist, an interloper who is using the Democratic Party as a vehicle for his own benefit in a country where third-party candidacies cannot succeed.

Second, Sanders has to confront an even more hostile and sceptical media than Corbyn must. Under US law, Fox News is under no obligation to be “fair and balanced” towards Sanders – nor is CNN, for that matter.

Thanks to the UK rules on broadcaster impartiality, however, Corbyn was “able to speak directly to the voters who still get their news from TV instead of the internet”, Sandberg notes. “In contrast, Bernie was completely and totally shut out by broadcast media in the US, which considered his campaign totally irrelevant.”

Third, Sanders failed to connect with minority groups, and especially with African Americans, whereas black and Asian British voters flocked to Corbyn – a veteran campaigner for the anti-racism movement.

Two out of every three ethnic-minority voters voted Labour on 8 June. “Bernie would’ve won [the Democratic nomination] if he’d had a message that resonated with 50 per cent – just 50 per cent – of black voters, because Hillary got upwards of 90 per cent in many states,” the activist and journalist Naomi Klein, who is a supporter of both Sanders and Corbyn, told me in a recent interview for my al-Jazeera English show, UpFront, which will air later this month.

Nevertheless, she is confident that Sanders can learn lessons from his own campaign for the 2016 Democratic nomination, and “build a winning coalition” next time which ties together the narratives of financial, racial and gender inequality.

Just as it was a mistake to write off Jeremy Corbyn, it would be wrong to dismiss Bernie Sanders.

Despite media bias, and even though he doesn’t have a party machine behind him, Sanders today is still the most popular politician in the United States. And so this may be only the beginning of a new, transatlantic partnership between the two self-declared socialists. Those of us on the left who grew up watching Reagan and Thatcher, then Clinton and Blair, then Bush and Blair, may wish to pinch ourselves to check we’re not dreaming.

“I think by 2021,” Sandberg says, “we may see Prime Minister Jeremy Corbyn sitting down with President Bernie Sanders.”

Don’t say you weren’t warned.