Bernie Sanders outperformed the wildly wrong polls in Michigan in a ludicrous upset of Hillary Clinton in Michigan's Democratic primary.

The former secretary of state led by an average of more than 20 percentage points in the lead-up to Tuesday's vote, a margin so far outside the margin of error. Yet the Vermont senator, whose campaign has napalmed expectations, slid past Clinton by a couple of points with more than 93 percent of vote counted.

The two candidates debated Sunday night in Flint, the site of an environmental mess that shoved the city of about 100,000 into an unwanted spotlight. Sanders had played Clinton to a draw there with 72 percent of the vote counted as of midnight Wendesday, with both contenders netting about 19,000 votes. Although Clinton cleaned up in Wayne County, home to Detroit, Sanders hung with her in the surrounding counties and outperformed Clinton all throughout the southwestern and central regions of the state.

The Democrats award state delegates proportionally, meaning Sanders's victory won't net him a complete delegate haul. But his triumph there is phenomenal (and bizarre), nonetheless.

"I just want to take this opportunity to thank the people of Michigan, who kind of repudiated the polls that had us 20, 25 points down a few days ago and repudiated the pundits who said that Bernie Sanders was not going anywhere," Sanders said as the ballots were being tallied late Tuesday.

The most recent surveys in Michigan showed Clinton with the following leads since March 1: +28, +17, +11, +13, +24, +37, +27. At no point did Clinton seem likely to win in anything but a rout.

Republican National Committee chairman Reince Priebus crowed about the Sanders shocker.

"Clinton is a candidate in search of a message, and a compelling reason why Democrats should make her their nominee. Her attempts to politicize the Flint water crisis and flip flop on trade deals she originally supported failed and now she will surely roll out a new campaign message without addressing the fact that voters do not like or trust her," he said in a statement issued early Wednesday morning.