SELMA, Ala. — On the eve of the Alabama Senate election, Ted Taylor’s phone rang. Former President Barack Obama was on the other end of the line.

“I got a call from Barack,” Taylor, a retired aircraft mechanic from Selma, Alabama, recalled on Wednesday. “I said to my wife, Obama is on the telephone. It’s a robo-call, but he’s telling black people to go out and vote.”

Obama had recorded the robo-call for Doug Jones, a former U.S. attorney who won a stunning victory over his Republican opponent Roy Moore Tuesday night. Obama didn’t single out voters by race in the robo-call, but Taylor, who is black, said he got the message.

Taylor and thousands of other black voters turned out for Jones, a key constituency that swayed an election dominated by Moore’s alleged sexual misconduct.

According to exit polls, 29 percent of African Americans in Alabama voted, slightly higher than the black turnout of 28 percent in the 2012 presidential election, when Obama was on the ballot.

The support for Jones among African Americans was overwhelming. He received 96 percent of the overall black vote and 98 percent of the vote among black women. And Jones surprised many political observers with a better-than-expected turnout in cities with large black populations like Birmingham and Montgomery.

Jones’ victory has sparked an avalanche of stories, including this one, about how black voters put him over the top.

But in Selma, a majority black city steeped in the history of the Civil Rights movement, many African American voters said they saw it coming.

“After Donald Trump got elected, you can expect a large turnout from black voters everywhere,” said Willy Franklin, a 63-year-old retiree who voted for Jones. “Because otherwise we’re going to lose everything. This is only the beginning.”

Sherry Mitchell, a community activist in Selma, echoed the sentiment. Black voters saw a clear choice between the two candidates that went beyond the sexual misconduct allegations, said Mitchell, a member of the group Alabama New Coalition.

On Election Day, Mitchell said she helped get 300 people to the polls. In Jones, many black voters saw a Democrat who would fight to protect Medicaid, food stamps, and other programs that benefit the state’s low-income black population, she said.

“The Democrat we voted in will fight for us to have as much as we can. Republicans don’t want us to have anything. They’re just rich millionaires. They don’t care about poor people,” Mitchell said.

Mitchell said she wasn’t shocked by the high turnout among black women, either.

“There’s a lot of single women here trying to raise children mostly on our own. It’s very hard. We can’t afford to lose everything we’ve got,” Mitchell said.

The allegations against Moore played a factor, of course. Among Jones supporters, 83 percent said the allegations were an important factor in their vote, exit polls showed. Overall, 89 percent of the people who voted for Jones believed the allegations, which were made by several women who accused Moore of sexual misconduct when they were teenagers and he was in his thirties.

“I was really disgusted by his personal life,” Sharon Wilson, 45, said of Moore. “When they came out, I really didn’t want to believe it. But I don’t think all those women came out for no reason.”

The Jones campaign made a concerted effort to reach out to black voters, knowing their support was crucial in counteracting Moore’s popularity among white, evangelical voters in the state.

Sen. Cory Booker, D-N.J., and former Democratic Massachusetts Gov. Deval Patrick, two popular black political figures, campaigned for Jones in the final days of the race, as did several other members of Congress.

In campaign advertisements, Jones highlighted his prosecution, as a U.S. attorney, of two Ku Klux Klan members who were responsible for bombing a Birmingham church in 1963. The attack killed four African American girls.

While Jones’ track record likely made a difference, several people involved in the Alabama race said that the on-the-ground outreach to black voters was the deciding factor in driving up black turnout.

Voter registration and get-out-the-vote organizations blanketed the state in recent weeks, urging people to vote on Election Day. Vote.org, a nonpartisan group, spent $658,000 in the final four weeks of the race in a targeted effort to increase black turnout, according to the group’s founder, Debra Cleaver.

“We theorized that investing in outreach to black voters would increase black voter turnout,” Cleaver said in a phone interview Wednesday. “This is just common sense. If you encourage people to vote in a nonpartisan fashion, then people will vote.”

The group paid for 140 billboards around the state, in cities like Birmingham and Mobile, with a one-word message: “Vote.” Cleaver said the group also sent direct mail, and over 600,000 text messages to black voters with information on their polling locations.

“What mattered most was all the groundwork that all of the organizations were doing,” State Sen. Hank Sanders, a Democrat whose district includes Selma, said in an interview Wednesday at his law office in Selma.

“I’m certainly glad that Senator Cory Booker came, I’m glad that former Governor Deval Patrick came, and the Congress members who came at the last minute,” Sanders said. “But those appearances were icing on the cake. They weren’t the cake.”

Sanders, who is black, said the election became a symbol of “this great struggle between two visions of Alabama,” as well as a referendum on Trump, who remains deeply unpopular with non-white voters over his policies and rhetoric around race relations.

“Roy Moore was linked to Donald Trump, and that was also a significant factor in being able to motivate people,” Sanders said.

Moore’s own statements on race didn’t help. Towards the end of the campaign, when asked at an event to name a time when America was great, Moore named the era of slavery. Taylor, the retired aircraft mechanic, said Moore’s campaign represented a sad turn of events, just one year after Obama left office.

Obama’s robo-call was a fitting end to the election, he said. “I was going to vote anyway, but that encouraged me,” Taylor said. “I heard the drum beat.”