In Alabama's Republican Senate primary on Tuesday, Steve Bannon defeated Donald Trump. The state's GOP voters showed how sharply divided their party is. And right-wing insurgents were given a license to challenge Republican incumbents all over the country in 2018.

Judge Roy Moore's victory over Senator Luther Strange was a sign of just how extreme Republican rank-and-filers have become. Moore, who believes biblical law should override the Constitution, beat Strange 55 percent to 45 percent. Contrast that with the 2006 gubernatorial primary in which then-Gov. Bob Riley trounced Moore by a margin of 2-to-1.

Moore is now 70 years old and was twice suspended as the chief justice of the Alabama Supreme Court for refusing to obey laws he saw were at odds with his religious beliefs. Normally all this would be career ending. But that was before the Age of Trump. "What Donald Trump has done," said Republican pollster Whit Ayres, "is embolden the Roy Moores of the world."

The most remarkable aspect of the Moore-Strange confrontation is how it became a test of wills between Trump and Bannon, the avatar of nationalist conservatism ousted last month as the president's chief strategist.

Encouraged by the Republican leadership in Washington, Trump endorsed Strange, the 6'9" establishmentarian appointed to the seat in February. He dubbed him "Big Luther." (Trump was so embarrassed by his chosen big guy's big defeat that he deleted earlier pro-Strange tweets.)

Bannon saw the Alabama contest as an occasion for teaching his former boss a lesson. Trump seems to think that his support base is so loyal to him that it will follow him anywhere. Bannon would beg to differ. He threw his all behind Moore's candidacy to show that Trump's movement is attached even more to a rebellious right-wing ideology than it is to the president himself.

Bannon got exactly what he wanted. "Ironically, given who Trump supported, what got Moore nominated is what got Trump nominated," said Anna Greenberg, a Democratic pollster. "What's going on is bigger than Trump, and he is just a vehicle."

The good news for Bannon is very bad news for Senate Majority Leader Mitch McConnell, who put millions of dollars behind the campaign to defeat Moore. Strange's defeat came on the same day that McConnell was forced to back off his latest effort to repeal Obamacare. Taken together, the two events showed how the GOP is fractured several ways at once. Even as the party's far right threatens to run rampant in future primaries, its more pragmatic wing in the Senate refused to rally behind a health care bill destined to be deeply unpopular and rushed forward in a way that violated the norms of responsible legislating.

Moore's triumph, in the meantime, presents Democrats with opportunities—and a hard choice.

The judge's views can only be called wacky — or worse. Among other things, he has said that parts of America are under Muslim Shariah law; suggested that the 9/11 attacks happened because the country had forsaken God's "word and trust"; said of Russia's president Vladimir Putin: "Maybe he's more akin to me than I know"; and likened homosexuality to bestiality.

Democrats will relish asking Republican candidates everywhere to take a stand on Moore's catalog of zaniness. But they will also have to decide how big a push to make on behalf of Doug Jones, a former U.S. attorney who is their nominee for the December special election.

Jones has the potential to be a strong candidate, but some Democratic strategists have counseled against committing substantial resources to a state where successes for their party have been scarce. Advocates of a major undertaking on behalf of Jones see this as precisely why taking on Moore would be worth the gamble. Jones could do in Alabama this year what Republican Scott Brown did in a 2010 special election in Massachusetts: demonstrate the dominant party's vulnerability going into the midterm elections by capturing a Senate seat far inside opposition territory. A Jones win would also cut the Republicans' already tough-to-manage Senate majority to a bare 51 seats.

And whatever happens in December, Bannon himself is determined to make the job of Congress' current GOP leadership as difficult as possible. At an election eve Moore rally, Bannon called out McConnell and Karl Rove, President George W. Bush's top political adviser, by name.

"Your day of reckoning is coming," Bannon declared.

It's a statement that also applies to Trump. The message from Alabama is clear; he and his party have unleashed forces they cannot control.

— E.J. Dionne's email address is ejdionne@washpost.com. Twitter: @EJDionne.