THANK YOU, Alabama.

In Tuesday's special election, the state by a narrow margin chose to spare the nation the indignity of seating an accused child molester in the U.S. Senate. Though the stain of electing Republican Roy Moore would have sullied Alabama, seemingly confirming every negative stereotype about the Deep South state, the shame would have been national. Instead, Alabama voters chose Democrat Doug Jones to represent them until 2021.

Mr. Jones is not in perfect sync with many Alabama voters on some issues, most notably abortion. But he is an honorable man with an admirable record of public service who ran a respectful campaign. His behavior suggests he will serve with decency and care in the Senate. None of these fine things could have been said of Mr. Moore. It is beyond heartening that Alabamians refused to overlook or forgive Mr. Moore's misshapen character.

Even before woman after woman shared stories of Mr. Moore preying on them when they were teenagers and he was in his 30s, Mr. Moore had disqualified himself from serving in public office. As Alabama's Supreme Court chief justice, Mr. Moore twice flouted federal court rulings simply because he did not like them. He had long stood for lawlessness and disorder. He called for "homosexual conduct" to be outlawed, said a Muslim should not be seated in Congress and waxed nostalgic for the era of slavery. But most egregious were the tales of traumas Mr. Moore inflicted on teenage girls.

Mr. Jones's victory shows that, while partisanship might be extreme, it still has limits. Even in deep-red Alabama, enough voters refused to succumb to lies about how negative stories on Mr. Moore were merely fake news cooked up by a hostile media.

Americans do not send senators to Washington merely to vote mechanically on a few hot-button issues, but to exercise judgment when cameras are not rolling, on issues that are important but not headline-grabbing. Good lawmakers also protect the nation's democratic institutions, preserve the independence of their branch of government and work with people with whom they disagree. It takes character to fulfill these responsibilities. Mr. Jones seems ready to do such work.

Mr. Jones's victory also suggests that the nation's recent awakening on sexual harassment and assault is spreading across the country. Enough Alabamians believed the women.

If Americans should feel grateful to Alabama voters, so should the Republican Party, much of which debased itself by following President Trump into the gutter of support for Mr. Moore. Its majority in the Senate will be slightly narrower, but the dignity of the Senate GOP caucus will be at least partially salvaged. Alabama voters spared the Senate Ethics Committee the dilemma of how to handle a senator who was clearly unfit but who nevertheless won a popular election. Instead of inviting controversy and chaos, they elected Mr. Jones, a man who deserves the honor.