Winning Oklahoma is not going to get Bernie Sanders the Democratic nomination.

But Sanders surprised many observers in taking the Southern state by a 10-point margin on Tuesday night, suggesting for the first time that the Vermont senator's coalition could extend beyond the Northeast.

The results are particularly counterintuitive when you consider that Sanders was also defeated in Massachusetts, which is much more reliably liberal. But how did a candidate with the most left-wing policy positions win one of the most conservative states in the country while also losing one of the most liberal?

Race and economics help explain why Sanders won Oklahoma

As Slate's Josh Voorhees points out, part of the story here is race. Oklahoma's Democratic primary electorate was 75 percent white — much higher than the other Southern states that Clinton won by huge margins, where black and Latino voters often made up more than half of the total.

"It’s more of a Western state than a Southern one, in that blacks are only about 7 percent of eligible voters and Hispanics are about 5 percent," says Matthew Dickinson, a political science professor at Middlebury College.

But race can't account for the full story here, either.

Oklahoma is whiter than many of the states Sanders lost on Tuesday. But it's not as white as Massachusetts, where Caucasians formed 86 percent of the electorate and Sanders lost anyway, according to exit polls.

In fact, it's arguably the economic class of those white voters that made a bigger difference.

In Oklahoma, Sanders won 54 percent of the vote among families earning less than $50,000. He did just as well with the lower-income brackets in Massachusetts. If low-income voters had been as big a share of the electorate in Massachusetts as they were in Oklahoma, Sanders could have won Massachusetts.

The difference is that affluent people made up a much bigger part of the Democratic electorate in Massachusetts than they did in Oklahoma. About half of the electorate in Oklahoma reported earning less than $50,000. That same lower-income group formed only about 30 percent of the electorate in Massachusetts.

This suggests more evidence that Sanders has built broad support with low-income white voters, even outside of liberal states like Iowa and New Hampshire. So far, that effort that has not proven successful with low-income nonwhite voters.

Oklahoma's party rules may have also favored Sanders there — plus his stance on fracking

Dickinson, the Middlebury professor, listed a few other reasons for Sanders's success in Oklahoma, including the fact that Sanders made several trips to the state and heavily targeted it in his campaign.

Oklahoma also has a "closed primary" — meaning voters had to be registered with the party — which normally means the electorate has more voters with strong partisan affiliations, according to Dickinson. That could have helped Sanders, Dickinson said.

"Finally, there is some concern there for the impact of fracking on the environment, particularly the link with earthquakes, and Sanders has come out strongly against fracking," Dickinson said in an email. "That might appeal to those likely to vote in the Democratic race."

Additionally, Randy Krehbiel, a reporter covering the campaign for the Tulsa World, said in an interview that the Democratic Party in Oklahoma has gotten increasingly liberal as it has shrunk over the past several years. Turnout was down in 2016 from 2008, he said, and the Oklahoma Democrats who are left tend to no longer include the moderates and conservative "New Dealers."

"A lot of those people are gone. The more conservative Democrats are dead, or they've moved to the Republican Party," Krehbiel said. "The Democratic Party is smaller and more liberal here than it was eight years ago."

Watch: Bernie Sanders explains primary debate counts