Former judge Roy Moore won the Republican nomination on Tuesday evening in the Alabama special election to fill the Senate seat vacated by Attorney General Jeff Sessions, defeating the Trump-endorsed former state attorney general Luther Strange.

Moore is an insurgent candidate who was removed from the Alabama Supreme Court in 2003 after refusing to move a monument to the Ten Commandments from the state judicial building.

The Associate Press called the race for Moore just before 9:30 p.m. EDT. Decision Desk HQ projected earlier in the night that Moore would win.

Moore’s opponent, Luther Strange, aside from President Trump’s endorsement, had benefited from millions of dollars in spending from political groups aligned with Senate Majority Leader Mitch McConnell. Neither were sufficient to put him over the top.

The outcome isn’t entirely surprising, however. In the run-up to the race, Strange, who was temporarily appointed to the Senate seat in February by then-Alabama Governor Robert Bentley, had trailed in the polls, lagging behind his challenger.

Earlier on Tuesday, Trump had tweeted: “ALABAMA, get out and vote for Luther Strange.” The president seemed acutely aware that his ability to play kingmaker was on the line. Trump claimed on Tuesday that “Strange has been shooting up in the Alabama polls since my endorsement,” though it is unclear what polls he was referring to.

The RealClearPolitics average showed Moore in the lead before the race results were in, and ahead in all four of the most recent polls. Trump first endorsed Strange in August ahead of the initial primary race. But as Geoffrey Skelley of the University of Virginia Center for Politics noted in an email, “Strange only won 33 percent in the primary, one of the worst incumbent primary performances ever.” Moore won roughly 40 percent of the vote in that first round contest.

The runoff election for the Republican primary took place on Tuesday after none of the GOP candidates won a majority of the vote in the August primary.

Adding a high-profile twist to the race is the fact that former White House chief strategist and Breitbart chairman Steve Bannon decided to get involved, showing up to headline a rally in support of Moore on Monday after Trump visited the state in support of Strange the week before. A Breitbart article titled “25 Key Conservative Endorsements of Judge Roy Moore in Alabama Primary,” lists endorsements for Moore ranging from former Republican vice presidential nominee Sarah Palin to failed Republican presidential candidate Mike Huckabee.

As my colleague Rosie Gray put it: the outcome of the special election primary will help answer the question of “who is more influential with Trump’s base: Trump himself, or the constellation of powerful voices on the right to whom base voters listen and who are supporting Moore?”

Moore’s victory will elevate a highly-controversial figure to a prominent position in American politics. After refusing to remove the Ten Commandments Monument, Moore was suspended from the Alabama Supreme Court in 2016 after attempting to block the federal Supreme Court’s ruling legalizing same-sex marriage. In August, Moore claimed that there are communities in Illinois and Indiana that are “under Sharia law right now” in an interview with Vox, an assertion that PolitiFact found “zero evidence” to substantiate.

A victory for Moore calls into question the power of a presidential endorsement in down-ballot Republican races. And it might make life more difficult for McConnell given that Moore has styled himself as an outsider antagonist to the majority leader on the campaign trail, accusing him of “dirty tricks and schemes,” in one campaign email that called Strange McConnell’s “crony.”

Moore will now advance to the December general election where he will face off against Democratic candidate Doug Jones. Any Democratic candidate is a long shot  in the red state of Alabama, however, and Moore will head into the general election as a heavy favorite to win.