Senator Luther Strange after voting with his wife, Melissa, Tuesday, Aug. 15, 2017, in Homewood, Ala. (Photo: Butch Dill/AP)

Republican Sen. Luther Strange rode an endorsement from President Trump and a well-funded war chest to secure a spot in next month’s runoff election Tuesday, clearing the first hurdle in his bid to more permanently fill the seat vacated by U.S. Attorney General Jeff Sessions.

But he will face in the runoff the former state Supreme Court Chief Justice Roy Moore, who won Tuesday’s primary election with 39 percent of the vote (as of 10:30 p.m. ET). Moore fell short of the majority of votes needed to secure the nomination outright, and Strange beat out Rep. Mo Brooks by a little over 12 points.

On the Democratic side, former U.S. Attorney Doug Jones won his party’s nomination outright, although the chances of him defeating a Republican in the general election in the deeply red state seems unlikely.

Trump and Senate Majority Leader Mitch McConnell have placed big bets on Strange, who was appointed in February to the seat by former Gov. Robert Bentley. Both Trump and Vice President Mike Pence have sent out multiple tweets instructing their supporters to vote for Strange. McConnell has pumped millions into the race from the Senate Leadership Fund, a super-PAC used to support incumbents.

A six-foot-nine former college basketball player, Strange served for almost a decade as a Washington-based lobbyist for energy companies. After a stint as a private attorney, he was elected state attorney general in 2011.

His appointment to fill Sessions’ seat created a small firestorm at the time and has been a key issue in the campaign. Bentley was under impeachment investigation by lawmakers for misappropriating state funds as part of an affair with an aide.

While an Alabama House committee was initially charged with leading the investigation, in November 2016 Strange asked that his office take over work related to it. Some saw Strange’s appointment as a way for Bentley, who later resigned, to scuttle the investigation.

“By the attorney general vacating the office, the governor gets to single-handedly choose a lawyer to investigate him and his girlfriend,” State Auditor Jim Zeigler said at the time. “”The whole thing stinks.”

Story continues

Strange has denied any collusion existed.

“I asked the team I put together to follow the truth wherever it led. They did. So the governor resigned,” Strange said last month.

Potentially more harmful in the runoff for Strange is McConnell’s support, which resulted in a flurry of primary attack ads from Moore and Brooks. Moore in particular has harshly criticized McConnell’s leadership and the money he is pumping into the race, saying he would not support the majority leader if elected.

GOP candidate for U.S. Senate Roy Moore speaks during a candidates’ forum in Valley, Ala., Aug. 3, 2017. (Photo: Bill Clark/CQ Roll Call/Getty Images)

In an election with more than it’s fair share of controversy, it should perhaps come as no surprise that Moore, one of the state’s most controversial political figures, came out on top.

Moore is best known for his refusal to remove a statue of the Ten Commandments he commissioned and installed in the state judicial building. The American Civil Liberties Union filed suit, arguing the monument represented government endorsement of religion, and won. Yet Moore defied a federal judge’s order to take down the statue, prompting large rallies of support outside the state capitol in Montgomery. The commandments were eventually taken down and a state judiciary committee stripped Moore of his post, saying he acted unethically.

After running and winning back the job of chief justice, Moore again found himself in hot water after ordering state probate judges to disobey a Supreme Court ruling allowing for same-sex marriage nationwide. The Southern Poverty Law Center filed a complaint over the issues and Moore was suspended for the remainder of his term, which ran until 2019.

Moore has gotten no less strident after resigning to run for senate. He often quotes from the Bible on the campaign trail and maintains his opposition to same-sex marriage. When told by a Guardian reporter that he shared that viewpoint in common with Russian President Vladimir Putin Moore responded that “Well, maybe Putin is right … Maybe he’s more akin to me than I know.”

Steve Flowers, a political commentator in Alabama and a former GOP state legislator, told Yahoo News that Moore’s victory is unsurprising given his relatively small yet strong base of support.

“When the race began, Roy Moore had a solid 30 percent, it’s been there since the beginning,” Flowers said. “His people are probably more fervent and ardent than the other supporters.”

Given that many of Brooks’ voters are likely to support Moore, the former judge is a legitimate threat to Strange and, in turn, McConnell and Trump, in the runoff.

“Washington consultants are convinced that Moore is beat in a runoff,” Flowers noted. “I don’t necessarily buy that.”

Read more from Yahoo News: