Jeremy Corbyn seems to have pulled off the impossible. Britain’s prime minister, Theresa May, called an early election just seven weeks ago, and at the time, Corbyn was seen as having no chance at getting even a half-respectable result. His left-wing Labour Party lagged as much as 20 points behind May’s right-wing Conservatives. Even members of his own party warned of a historic defeat.

And yet, as Britons voted Thursday, it became evident that something had changed. Corbyn had clear momentum. In the end, he was able to not only quash May’s dreams of bolstering her slim majority in Parliament but to gain Labour seats. The Conservatives have now been forced into an unstable minority government with help from Northern Irish unionists to pass legislation. While May is staying in office for now, in the medium term, her chances of remaining at 10 Downing Street look dim.

When considering Corbyn’s polling numbers over the past few weeks, it’s tempting for Americans to look at another recent electoral upset by an underdog closer to home: Donald Trump.

The comparison is appropriate in some ways. Both politicians have tapped into anger at the status quo, a feeling that can be observed around much of the world.

“Jeremy Corbyn represented a challenge to the government,” said Ben Page, chief executive of the polling firm Ipsos MORI, adding that Labour’s platform spoke to an anti-elite anxiety as widespread in Britain as elsewhere. One unnamed Corbyn aide even told Politico this year that the Labour leader planned to copy media strategies from the Trump playbook.

But big differences in the political landscape, not to mention the candidates themselves, limit such comparisons. Corbyn’s electoral success can also be read as a backlash to Britain’s rightward swing in recent years, including last summer’s vote to leave the European Union. He has some anti-establishment rhetoric, yes, but that rhetoric and the support it attracts are distinct from the ethos of Brexit or Trump.

As politicians, Corbyn and Trump do share some similarities. Both are roughly the same age but entered mainstream politics only recently. They grew their support through social media and rallies, while facing ridicule from the political elite and media outlets. At certain points, they have shared some views on international affairs, criticizing foreign intervention and the logic of NATO. And both Corbyn and Trump stand accused of making unrealistic promises on the campaign trail but ultimately performed better than expected against more established female politicians (though both Corbyn’s Labour and Trump received fewer votes than their rivals).

The contrasts in the two men’s backgrounds far outweigh the similarities, however. Corbyn is an old-school British leftist who cut his teeth in the antinuclear protests of the 1980s. Trump is a real estate developer turned reality television star who made his political career by suggesting that President Barack Obama was born in Kenya. While Corbyn was riding his bike to work in Parliament, Trump was flying between resorts in a personally branded private jet.

These different backgrounds are reflected in their ideologies. The British politician has a dogmatic view of social democratic policies and has spent decades in that ideological world. Trump’s political views seem to be malleable: A former Democrat, he is now a Republican who enjoys the support of the far-right fringe. Though Corbyn was once a leftist Euroskeptic, he campaigned for Britain to remain in the European Union last year. Meanwhile, Trump dubbed himself “Mr. Brexit” and formed a personal bond with Nigel Farage, the former leader of the anti-Europe, right-wing U.K. Independence Party.

There is little possibility of warm personal ties developing between Corbyn and Trump. While May has been keen to present herself as one of the U.S. president’s key allies, the Labour leader has criticized Trump frequently. “Donald Trump should not be coming to the U.K.,” he said in February.

But the frustration with political norms that helped Trump in the United States is certainly evident in Britain, too. Page pointed to the Ipsos Global Trends survey, which compares the attitudes of select countries, including Britain and the United States, on politics and social changes. The survey found last year that more than three-quarters of Brits and Americans believed that the economy was rigged to favor the rich and powerful. A slightly lower percentage thought the government does not prioritize their concerns and the concerns of those like them.

British exit polls don’t collect the same complicated data that their U.S. peers do, so a full postmortem on how this anti-elite sentiment may have helped Corbyn isn’t available yet. But there are some hints in pre-election polls. Chris Curtis, a political researcher with YouGov, noted that in the final poll conducted this week, 58 percent of Labour supporters suggested that health care was the most important issue facing Britain, compared with 27 percent of Conservative supporters. May was widely accused of being out of touch after telling a nurse that her lack of pay raises was because there was no “magic money tree.”

In clear contrast to Trump, who received support from significant numbers of older voters, under Corbyn Labour is believed to have found more younger supporters — in part because of dramatic promises such as Corbyn’s pledge to abolish tuition fees at British universities. Registered-voter turnout is reported to have risen to 69 percent for this election. “We believe it will have rose proportionally among the young,” said Page, adding that most of these young voters are likely to have gone to Corbyn.

Where once polls missed right-wing voters, now they ran the risk of missing younger left-leaning voters, Page said. Many of these voters were frustrated by the past seven years of Conservative rule. Britain was once politically divided by its class system, he added, but “now we are a country divided by generations.” Another factor was that after years of political fragmentation, Britain appears to be returning to a two-party system — meaning a distinctly left-wing Labour may be regaining some voters who began supporting the more centrist Liberal Democrats a little over a decade ago.

The biggest similarity between Corbyn and Trump may not have been their campaigns or their support, but their opponents. In the United States, some analysts criticized Democratic candidate Hillary Clinton for running a lackluster and arrogant campaign against her underestimated, upstart rival. In Britain, much of Corbyn’s success is being attributed to May’s failures.

“People went into this election with a very strong impression of Theresa May,” Curtis said, “then she ran a campaign that really went against her chief strengths.” Instead of offering an impression of “strong and stable” leadership, May appeared “weak and wobbly” on the campaign trail. That failure may have helped the initially unpopular Corbyn with the “fastest and most incredible shift we’ve seen since YouGov started polling,” Curtis said.