The Senate majority leader, Mitch McConnell, made it a major priority to keep Strange—a former Washington lobbyist and reliable Republican vote—in the Senate. But two anti-establishment troublemakers entered the race against him. Moore, a stalwart of the local and national religious right, and a known quantity to Alabama voters, was one; Brooks, an archconservative member of the House Freedom Caucus who had chaired Ted Cruz’s Alabama campaign, was another.

Moore has his own brand in Alabama independent of the politics of the moment, a devoted band of followers who can be counted on to vote in GOP primaries. Local experts like to say he had a “high floor but a low ceiling”: Even in a primary, he would have a hard time broadening his appeal beyond his built-in base.

Brooks had the support of national conservatives like Sean Hannity and Mark Levin, but wasn’t well known outside his North Alabama congressional district. He sought to turn the race into a referendum on the Washington GOP establishment, particularly McConnell—one of his final campaign events was a “Ditch Mitch” rally Monday night. But his ambivalent relationship with the president, whom he had criticized in the past, didn’t play well with Trump-loving Alabama Republican primary voters.

Brooks’s onetime antipathy for Trump was a major theme of the multimillion-dollar barrage of attack ads aired by Strange and his allies. (A source who polled the race told me Trump is viewed favorably by 68 percent of Alabama Republicans.) But the killing blow came a week before the election, when Trump unexpectedly endorsed Strange on Twitter—the first time the president has waded into a contested GOP primary. Trump apparently did it as a favor to McConnell—but then went after McConnell when he learned the majority leader had been patronizing him behind his back. Still, the president stuck with Strange, issuing more tweets and a recorded message in favor of the incumbent.

Trump’s popularity likely helped drag Strange across the finish line in second place. But it’s notable that his endorsement was only good enough for second place, and less than a third of the primary vote, for his favored candidate. Now Strange faces Moore one-on-one for the nomination, with Moore positioned as the outsider and Strange as the Washington candidate tainted by corruption.

McConnell’s allies have indicated that they intend to go hard against Moore, whose Bible-thumping ways do give many Alabamans pause—one Brooks voter I met told me it was hard enough telling out-of-staters you’re from Alabama without Moore underscoring outsiders’ stereotypes. “Here’s the question, what happens when McConnell & Co. train their guns on Moore?” asked David Mowery, a Montgomery-based consultant who ran a Democratic campaign against Moore that nearly succeeded in 2012. “He is very, very hard to attack,” because of his reputation for standing on principle.