Want to listen to this article out loud? Hear it on Slate Voice.

It is difficult to overstate the magnitude of the Democratic Party’s victory on Tuesday.

In the night’s most closely watched contest, a surge of Democratic voters—from moderate and liberal suburbanites in Northern Virginia, to college students in cities like Charlottesville, to black Americans in Tidewater—gave Ralph Northam a 9-point margin of victory, catapulting him over Republican Ed Gillespie in the race for governor of Virginia. Justin Fairfax and Mark Herring, the Democratic nominees for lieutenant governor and attorney general, respectively, won with similar margins in their races. (Fairfax became only the second black American elected to the office in Virginia’s history.) And all of this fueled a potential upset in the House of Delegates, where Republicans have held a majority for nearly 20 years. (As of this writing, officials are still counting votes in a handful of close races.)

This means real things for real people. With a near-majority in the House of Delegates, Democrats have a real shot at expanding Medicaid, which would extend health coverage to hundreds of thousands of Virginians. And with the governor’s mansion, they have veto power over redistricting. Democrats, in short, have a chance to reshape Virginia’s political landscape.

In New Jersey, Democrats repeated that feat. They easily reclaimed the governor’s mansion after eight years of Republican rule, as voters roundly rejected Chris Christie’s lieutenant governor, and they won surprise victories in down-ballot races against incumbent Republicans. In New York, Democrats captured a handful of local offices in the Hudson Valley and New York City—the kinds of suburban victories that could decide control of the House in next year’s midterms.

There are lessons here, for all sides. With this potent anti-Trump energy, Democrats have even more reason to step up recruitment and find candidates for every race. For the first time in years, Democrats contested local races across the country, and it paid tangible dividends. Republicans, in turn, have a couple of test cases for “Trumpism without Trump,” of what happens when a traditional Republican candidate runs a Trump-like campaign, without embracing the president himself.

The limits of that strategy will be the enduring effect of the race in Virginia, regardless of which party ends up capturing the House of Delegates. “Trumpism without Trump” is just a euphemism for the politics of white identity—for campaigns tuned to white racism and designed to stoke white racial resentment. This politics consumed the last weeks and months of the Virginia election, and its decisive defeat is one of the most important outcomes of Tuesday’s voting.

Not that Democrats were confident. Final polls had Northam in a neck-and-neck race, after Gillespie appeared to close a substantial gap by adopting Donald Trump’s style and rhetoric for his own ends. Gone was the staid, traditional Republican who nearly upset Mark Warner in 2014 through careful appeal to conservative suburbanites. Instead, in the final months of the campaign, Gillespie remade himself as a demagogue, playing on white racial resentment. He blasted Northam on MS-13—tying the gang to “sanctuary cities” and undocumented immigration—promised to protect the state’s Confederate monuments (“our statues” declared his ads), and linked Northam to protests by NFL players. Gillespie may have put physical distance between himself and Trump, who never came to campaign on his behalf, but rhetorically he wasn’t far behind the president.

The “culture warrior” persona was out of character for Gillespie, who once chaired the Republican National Committee, but it wasn’t a surprise. Before facing Northam, Gillespie fought a tough battle for the Republican nomination against Corey Stewart, a Republican local official and vocal supporter of President Trump. Stewart, a Minnesota native, built his campaign around the fight for Confederate monuments, trading on white nationalism in the name of “heritage.” He almost won, falling just a few thousand votes behind Gillespie. It was a sign: Most Virginians may dislike the president and his demagoguery, but Virginia Republicans craved it. Gillespie would deliver.

When it appeared Gillespie might actually win, key Trump allies were quick to claim credit, via Stewart. “Corey Stewart is the reason Gillespie is going to win,” said Stephen Bannon to the Washington Post. “It was the Trump-Stewart talking points that got Gillespie close and even maybe to victory. It was embracing Trump’s agenda as personified by Corey’s platform.” In New Jersey, the Republican candidate, Kim Guadagno, emulated Gillespie’s tactics in the final stretch of her own campaign, pivoting from property taxes to a focused assault on sanctuary cities, complete with a Willie Horton–style ad that accused her opponent of supporting an immigrant murderer. She lost by 12 points.

Had either Republican won, or come close, other Republicans would have taken note, charging into 2018 with campaigns aimed at the same kind of voters, with the same kind of message, with the same basic goal: to obscure an otherwise unpopular agenda with targeted appeals to white racism.

Now, instead of organizing around Trump-like appeals, Republicans have to reckon with the political environment going into next year. And that environment is dangerous. Trump is deeply unpopular, tangled by scandal and investigation. And Republicans overall are well behind in the generic congressional ballot, trailing Democrats by 10 points. In theory, individual Republicans can distance themselves from the president, but Virginia shows that is more difficult than it seems, even against a lackluster opponent. Gillespie tried as much as he could to downplay his connection to Trump. It didn’t work.

If there’s a single takeaway from Tuesday, it’s this: The rules of politics still apply. Unpopular presidents make for unpopular parties. It was true for Democrats under President Obama, and now, it’s true for Republicans.