A Democrat will be the newest senator for one of the reddest states in the country.

A key explanation for the shocking upset on Tuesday night in Alabama’s special election: Black voters turned out — and strongly backed Democrat Doug Jones over Republican Roy Moore.

The Washington Post reported the results by race, based on preliminary exit polls:

Doug Jones has won Alabama. Preliminary exit polls from @PostPolls point to black voters as the force behind the upset victory. https://t.co/q9ucxlS0er pic.twitter.com/HXC3OsYa0u — Post Graphics (@PostGraphics) December 13, 2017

There is also data that suggests Jones simply got much more of his base out to the polls than Moore did. Jones got about 92 percent of the raw vote total that Hillary Clinton did in 2016 in Alabama’s general election, while Moore got about 49 percent of the raw vote total that Donald Trump did in the state.

And this happened despite concerns about voter suppression efforts due to Alabama’s strict voter ID law and voting restrictions for people with felony records, both of which disproportionately impact black voters.

It’s too early to say decisively how Jones pulled this off over Moore. For example, did depressed white turnout play the defining role, or was it increased black turnout? Exit polls are simply not reliable enough to make these kinds of sweeping judgments. With more and better data, statisticians and researchers will wonk this out over the next few days, weeks, and months.

But one thing we do know for certain is that unique aspects of Jones and Moore as candidates, as well as the national political climate, made an outcome in which Jones triumphs with black voters fairly likely all along.

Moore’s slavery-friendly remarks resurfaced in the last few days

Black voters have, in general, heavily favored Democrats for decades now. But Moore was also a uniquely bad candidate for black voters.

For one, Moore was mired by bizarre comments over the last few days of the campaign in which he seemed to endorse or at least tolerate slavery.

First, comments resurfaced in which Moore appeared to say that the US should be more like it was during slavery. Asked by a black man at a September campaign rally what Trump means when he says “make America great again,” Moore at first acknowledged the US’s history of racial tensions. Then he said, “I think it was great at the time when families were united — even though we had slavery. They cared for one another. People were strong in the families. Our families were strong. Our country had a direction.” He later added that he was focused on culture, not policy, in his remarks.

Then Andrew Kaczynski at CNN uncovered 2011 remarks in which Moore responded positively to a radio host’s comment that all constitutional amendments after the 10th should be abolished. Moore said, “That would eliminate many problems. You know, people don’t understand how some of these amendments have completely tried to wreck the form of government that our forefathers intended.”

Among those amendments: the 13th abolished slavery, the 14th guarantees equal protection under the law (and was central to US Supreme Court cases that supported racial integration in public education and ended states’ bans on interracial marriage), the 15th protects black voting rights, and the 19th gave women the right to vote.

So you had two newly resurfaced comments that could be interpreted, at least in part, as fondly recalling the days of slavery.

Moore’s campaign of course strenuously denied this, telling me at one point that such an interpretation of his comments was “recklessly malicious.”

But when your candidate’s comments can be interpreted as anything remotely close to pro-slavery or slavery-tolerant, you have a big problem on your hands.

That’s especially true since Moore already had a history of racially insensitive and bigoted remarks, previously invoking the racist birther conspiracy theory by questioning if President Barack Obama was born in the US and comparing the US Supreme Court decision legalizing same-sex marriage to the 1857 decision that effectively denied black people citizenship.

In contrast, Jones had made a name for himself in the early 2000s by successfully prosecuting two Ku Klux Klan members for the 1963 bombing of the predominantly black 16th Street Baptist Church in Birmingham, which was one of the most high-profile white supremacist crimes — not just in Alabama, but nationally — of the era.

Combined, this gave black voters a very clear choice: On one hand, you have a guy who seems okay with slavery. On the other hand, you have a guy who prosecuted the KKK.

The national political climate probably helped Jones too

The broader context here matters as well. While the Senate campaign went on, we were in the middle of a national political climate that has taken a frighteningly racist turn.

President Donald Trump himself has a long history of racist remarks. He launched his modern political career by promoting the racist birther conspiracy theory — an idea that he is still reportedly promoting in private. As a candidate for president, Trump also made all sorts of racist comments — suggesting that Mexican immigrants are criminals and rapists, proposing a ban on all Muslims entering the US, saying a US judge should recuse himself from a case simply because of his Mexican heritage, and deploying dog whistles about “law and order.”

His administration has also pursued policies that will disproportionately hurt minority groups, including his travel ban, immigration restrictions, “tough on crime” policies, and potential voting restrictions.

All of this boiled over in August, when white nationalists, neo-Nazis, and KKK members descended on Charlottesville, Virginia, to protest the city taking down Confederate statutes. The protests quickly turned violent as the white supremacists faced off with counterprotesters who showed up to demonstrate against racism. That day, a Nazi sympathizer rammed his car into a crowd of counterprotesters — injuring dozens and killing 32-year-old Heather Heyer.

Trump’s response to all of this? He blamed both sides. “I think there is blame … on both sides,” he told reporters days after the protests. “I have no doubt about it. You don’t have a doubt about it either. If you reported it accurately, you would say that.”

As the head of the Republican Party, Trump was morally equivocating between literal white supremacists and anti-racism protesters.

This is the broader context in which Jones won and Moore lost. On top of Jones’s and Moore’s own unique qualities, the Republican Party as a whole has, due to Trump, been tied to outright racism. It is no wonder black voters would turn out against Moore and for Jones in this political climate.

Couple that motivation for higher black turnout with the allegations against Moore that he sexually abused teenagers, which almost certainly depressed turnout among Republicans in Alabama while pushing Democrats to get out to vote.

That’s how you get a situation in which the newest of two senators representing one of the most conservative states in the country will be a Democrat.