The Republican billionaire, who ran an overtly racist, extreme right-wing campaign, defeated Hillary Clinton in a massive political surprise this week, apparently losing the popular vote but winning the Electoral College tally.

This upset could likely have been avoided, however. Sen. Bernie Sanders, Clinton’s insurgent left-wing opponent during the primaries, repeatedly warned voters and the Democratic establishment that he had a greater chance of defeating Trump.

“Bernie Sanders continues to be the strongest candidate in the race to keep Donald Trump out of the White House,” his campaign stressed in a May press release. Polling done that month by a variety of news outlets and firms consistently found that Sanders had a double-digit percentage point lead over Trump, with Sanders’ average margin over the Republican being three times larger than Clinton’s average lead of 3.3 percent.

Experts said Sanders’ sizable lead over Trump was largely due to his popularity among independents and young voters, two groups with whom Clinton did not do nearly as well.

Sanders pollster Ben Tulchin noted at the time that the Vermont senator’s overwhelmingly “positive profile stands in stark contrast to both Hillary Clinton and Donald Trump, who are both deeply unpopular.”

Of the three major-party presidential candidates who remained in the race at that time, Sanders was the only one with a net positive favorability rating. Clinton had a net favorability rating of negative 21 percent and Trump’s was negative 29 percent.