Sen. Tim Kaine, D-Va., right, greets a poll worker as he prepares to vote in Richmond, Va., Tuesday, Nov. 6, 2018. Kaine is running against Republican Corey Stewart. (Steve Helber)

IN A season of polarization exploited by a president who used fear as an electoral cudgel, voters in the states bracketing the nation’s capital handed victories to relative moderates of both parties, repudiating the most partisan and extreme candidates. The results in Virginia and Maryland were a rebuff to both the Trumpian right and the Sandersonian left, and a pointed reminder to Republicans and Democrats that, in those two states at least, the sane center can and does hold.

That was the case in Virginia’s U.S. Senate race, where the incumbent Democrat, Sen. Tim Kaine, easily turned back a challenge from Republican Corey A. Stewart, a third-rate provocateur whose dog whistles to white nationalists were either inspired by or lifted verbatim from the president, Mr. Stewart’s political lodestar. Mr. Kaine is a thoughtful, knowledgeable and highly experienced former mayor and governor, but a seasoned Republican candidate who appealed to reason rather than the politics of incitement might have given him a run for his money. Virginia’s GOP chose its candidate poorly and has now lost its ninth consecutive statewide race in as many years, counting contests for governor, lieutenant governor and attorney general, as well as for the Senate.

In Maryland, similarly, the Democratic gubernatorial candidate, former NAACP chief Ben Jealous, was trounced by Gov. Larry Hogan, one of the relatively few remaining prominent middle-of-the-roaders in the Republican Party. Mr. Hogan owes his popularity in large part to his moderation, whereas Mr. Jealous opted for an expansive leftist platform that included so much spending on so many new, pie-in-the-sky programs that many of his own party’s stalwarts blanched. Given that registered Democrats outnumber registered Republicans by 2 to 1 in Maryland, it is difficult to believe that a centrist Democrat would not have fared better than Mr. Jealous.

In the most high-profile local race for the House of Representatives, in suburban Northern Virginia’s 10th Congressional District, Rep. Barbara Comstock, a two-term Republican in a district that has been trending Democratic, failed to convince voters that she was not in thrall to an unpopular president. She was defeated by Democratic state Sen. Jennifer T. Wexton, a smart, solid challenger. Despite sporadic gestures intended to suggest her independence, Ms. Comstock’s voting record was almost entirely in line with the White House.

Maryland Sen. Benjamin L. Cardin, a long-serving Democrat, coasted to an easy victory against token opposition, largely on the strength of his record as a no-nonsense, in-the-weeds lawmaker known far more for policy expertise than partisan point-scoring. His reelection, like Mr. Hogan’s, was never in doubt. It suggests that Maryland voters, at least, are much less wedded to party or ideology than they are to competence and subject-matter mastery.