Mobile, Ala. — Donald Trump and Steve Bannon are politically impotent.

The president and his former grand strategist threw considerable weight behind Roy Moore, the polarizing Republican Senate candidate in Alabama. For the second time this year, the state that gave Mr. Trump crucial early support during the presidential campaign — and his first senatorial endorsement — has rejected the candidate Mr. Trump endorsed for the Senate.

Extraordinarily high turnout among African-American voters pulled the Democratic nominee, Doug Jones, a former United States attorney, to a narrow victory. Mr. Moore was held back by a significant resort to write-in ballots (some 1.7 percent of the total, a fact on which Mr. Trump quickly fixated) that presumably came from voters who ordinarily lean Republican — suburban professionals, especially women — along with tens of thousands fewer suburban Republicans voting at all. For example, in Shelby County, neighboring Birmingham, Mr. Trump earned 73,000 votes and a 51,000-vote margin, but it appears that Mr. Moore won 36,000 votes and a 9,000-vote margin.

The last four days of the race, though, featured a series of embarrassments for Mr. Moore, several stemming from re-unearthed interviews of his and several more involving gaffes by his team at Mr. Moore’s final campaign rally.

As played through the social-media filter (meaning relevant context sometimes was lost), the interviews showed Mr. Moore saying: 1) life was better early in American history despite the existence of slavery; 2) American immorality may well make the United States the focus of evil in the modern world; and 3) all constitutional amendments after the 10th — thus including the antislavery amendments and the one giving women the vote — should be repealed.