Even though the polls always suggested the likelihood of Jeremy Corbyn’s defeat in yesterday’s British elections, his continued presence as the head of the Labour Party filled me with a great sense of foreboding. The local press excavated from Corbyn’s not-so-distant past videos that revealed him to be, at best, indifferent to anti-Semitism: as he vouched for the moral character of an imam who had accused Jews of drinking the blood of children; as he championed a mural artist who’d painted a cabal of hook-nosed bankers; as he accused Zionists of lacking “English irony.” When confronted with these statements—there are plenty more—he tended to express irritation rather than contrition.

A venerable political party that poses as the enemy of racism was suddenly and demonstrably rife with it. From the other side of the Atlantic, it was hard not to entertain the anxiety that something similar might plausibly happen here, and soon: In the leftward shift of the Democratic Party, a strain of Corbynism might implant itself.

As I have turned over this worry—the fear that the populist left might replicate the sins of the populist right—my concerns have usually been allayed by the fact that the American version of Jeremy Corbyn is Bernie Sanders. The two resurgent relics of the ’70s left have ascended in tandem—and their ascents have exposed subtle (but crucial) moral and ideological distinctions.

Read: Will Corbynism survive Jeremy Corbyn’s defeat?

The reasons to lump Corbyn and Sanders together are obvious enough. During the prime of their political careers, they were both dissidents howling at the neoliberal consensus. Decades of defiance left them as the lone, rumpled tribunes of an ideology that had supposedly been vanquished by history. But when the financial crisis of 2008 stoked raging indignation against the prevailing order, the zeitgeist unexpectedly gusted in their direction. Everything that had held them back—their righteous indignation, their indifference to artifice, their political isolation—suddenly propelled them forward.

While they share a skepticism of capitalism, they have different defining passions. As anyone who watched Bernie Sanders’s campaign in 2016 can attest, he doesn’t care that deeply about foreign policy. (For the first five months of that campaign, his website didn’t have a foreign-policy section.) Corbyn, by contrast, comes from a segment of the left motivated by anti-imperialism and its impulse to display solidarity with the subaltern. This makes Corbyn both more skeptical of his own government—as well as of the European Union—and more sympathetic to whatever groups he deems colonial victims. He made apologies for the Syrian barrel bomber Bashar al-Assad and Venezuelan President Nicolas Maduro. He once described members of Hamas and Hezbollah as “friends,” despite their histories of terrorism—a description he eventually retracted, after it already betrayed his core beliefs.

There’s no doubt that Sanders shares some of the Corbyn view of the world. He will sometimes invoke the inglorious American history of intervening in Latin America. But Sanders is less conspiratorial and more open-minded than his British cousin. Consider how differently they have reacted to Vladimir Putin. When the Russians poisoned an ex-spy and his daughter in Salisbury last year, Corbyn expressed immediate skepticism about how quickly the British government apportioned blame for the crime. Sanders hasn’t similarly hesitated to criticize Putin. He readily condemned Russian interference in the 2016 presidential election. And he has said that he would make opposition to authoritarian kleptocrats central to his foreign policy. (His speeches linking global inequality to illiberal authoritarianism contain a theory of kleptocracy that other candidates should borrow.)

While Sanders might have been a foreign-policy outlier in the years immediately following 9/11, his views aren’t so far from the prevailing post-Iraq consensus. He doesn’t reject humanitarian intervention on principle, even as he rails against endless wars. Sanders supported the U.S. air strikes during the Kosovo War; he was sympathetic to Barack Obama’s intervention in Libya, although he eventually came to view that policy skeptically. Where Corbyn has said that he wished NATO never existed, Sanders has merely bellyached about member states paying their dues.

At the core of Corbyn’s foreign policy is an obsession with Israel, which has manifested as incessant sneering about Zionism. Sanders hasn’t stoked rage against Zionists, perhaps because he is the descendant of Holocaust survivors, who spent several months living on a Kibbutz near Haifa in his early 20s. Although he tends to avoid talking about his ethnic identity, he published a recent essay in Jewish Currents, in which he wrote about his “pride and admiration for Israel” and the “enormous achievement of establishing a democratic homeland for the Jewish people after centuries of displacement and persecution.”

Derek Thompson: The Millennials-versus-Boomers fight divides the Democratic Party

That said, Sanders is often highly critical of Israel. He has toyed with the idea of leveraging U.S. military aid to prod Israel into ending the occupation of the West Bank, for instance, a substantial break with the consensus. And he has proved reluctant to call out anti-Semitism in the ranks of his own supporters, including one of his surrogates. On the subject of Corbyn’s bigotry, he has remained disappointingly silent.

But the point is that the rise of the left could have gone much worse for the Democrats. It could have taken the form of an apologist for dictators and a fomenter of anti-Semitism. Attacks on globalization could have veered into coded smears of globalists. The rightful flaying Wall Street deserves could have been expressed in nasty tropes. Perhaps judging a politician in relation to Jeremy Corbyn isn’t the most stringent moral test one could apply, but it’s worth a moment’s gratitude that Sanders passes.