The moment when the spell was broken came just a little after 10 pm Eastern Standard Time.

Through much of Tuesday night, Republican Roy Moore had led the count in the special election for the Alabama Senate seat that Jeff Sessions vacated to become Donald Trump’s attorney general. It was close. Democrat Doug Jones was still in the running. But Democrats were afraid to believe that a honorable man could defeat the scandal-plagued candidate of a scandal-plagued president.

This was Alabama, after all, a state that had disappointed Democrats in every presidential election since 1980, and in every Senate contest since 1996.

Could Alabama do the right thing?

Could the state that gave Donald Trump 62 percent of the vote in 2016 reject Trump’s candidate for a critical seat in a closely divided Senate?

Could the state that gave Hillary Clinton just 34 percent of the vote in 2016 defeat a sexist Republican who stood accused of molesting teenage girls?

Could the state of George Wallace and “segregation now, segregation tomorrow, segregation forever” elect a candidate who made his name prosecuting the Ku Klux Klan thugs who killed four little girls with the bombing of Birmingham’s 16th Street Baptist Church in 1963?

The answer came from Selma, the Alabama city that was central to the long march for civil rights and voting rights in the American South.

The Rev. Martin Luther King Jr. spoke in 1965 of a civil-rights movement that was on “a mighty walk from Selma, Alabama.”

It was fitting to recall those words on Tuesday night.

When the votes from Selma and surrounding Dallas County came in just a little after 10 pm, Moore’s lead began to evaporate. On CNN, John King announced, “Selma just put Doug Jones back into the race.”

A county where African Americans make up 70 percent of the population gave 75 percent of the vote to Doug Jones. That brought the Democrat 7,000 votes closer to victory. And as more votes from more predominately African-American counties came in, Jones moved into the lead. Within a half hour, the networks were announcing that a Democrat had won an Alabama Senate contest for the first time in almost a quarter-century.

African Americans formed 28 percent of the Alabama electorate on Tuesday. Doug Jones won 96 percent of their votes statewide, as compared with 31 percent of the white vote, according to exit polls.

That did not just happen. Jones and his supporters worked hard to mobilize and turn out the African-American vote. The congresswoman who represents Selma, Terri Sewell, argued on the eve of the vote that “[This] election is about the soul of this nation and the soul of Alabama. And, we who have been proud Alabamans know that we have been trying [to] overcome our painful past. And this candidate, Roy Moore, will only take us backwards and harken us back to the days of segregation and Doug Jones will take us forward.”

Jones needed all the votes that he got Tuesday. He won by a narrow margin—prevailing by a bit more than 20,000 votes out of roughly 1.3 million cast. But he could not have gotten near the finish line without the overwhelming support that he received from Alabama’s African-American voters in general, and from African-American women voters in particular.

“We have come so far,” Doug Jones said in his victory speech.

Everyone knew what he meant.

Just as everyone knew what it meant when Selma put Doug Jones into the race.