US President Donald Trump’s pick for Alabama’s Senate race has lost the state’s Republican primary to a firebrand Christian conservative.
Incumbent Luther Strange, 64, said he had called rival Roy Moore to concede the race.
“We wish him the best as he goes forward,” he told supporters.
Mr Moore is a populist former chief justice in the state, who rode to the voting booth on a horse named Sassy, and brandished a gun at a rally.
The news is likely to rattle Washington Republicans, including President Trump, who had confidently pitted Mr Strange against the party’s anti-establishment wing.
Mr Trump and Vice-President Mike Pence have both appeared with Mr Strange at rallies, while a political group linked to top Senate Republican Mitch McConnell is said to have spent nearly $9m (£6.7m) on his behalf.
The Senate seat was held by Jeff Sessions until February, when Mr Trump picked him to serve as US attorney general.
The president made his allegiance clear on 24 September, tweeting: “It was great being with Luther Strange last night in Alabama. What great people, what a crowd! Vote Luther on Tuesday.”
But within minutes of the result, he had thrown his weight behind the winning Republican candidate.
Mr Moore, 70, is best known for losing his position as the state’s top judge twice. The first time, he had flouted a court order to remove a Ten Commandments monument from the courthouse.
When the people of Alabama elected him to the court again, he was suspended for a second time for defying the US Supreme Court’s 2015 ruling legalizing gay marriage.
Alabama has not elected a Democrat to the Senate in a quarter of a century, so Mr Moore will be expected to beat his Democratic rival Doug Jones when they face off in a vote on 12 December.
Mr Moore had threatened to upend the Republican Party if he won the nomination and branded his opponent an “establishment lackey”.
Mr Moore, a bible-quoting evangelical, drew support from Christian conservative Sarah Palin – and recently-sacked White House chief strategist Steve Bannon.
Mr Bannon, the architect of President Trump’s “America First” agenda, claimed on Monday that Republican elites think Alabama voters are just “a pack of morons” who will vote as they are instructed to.
“You’re going to see in state after state people that follow the model of Judge Roy Moore, that do not need to raise money from the elites,” he declared at Mr Moore’s victory party.