As the midterm campaigns came to a close, President Trump made a gambit: If he appealed to white racial resentment—if he fanned the flames of racial fear and panic—perhaps he could stanch GOP bleeding and prevent a Republican wipeout. At rallies, he warned of immigrant crime and disorder. On Twitter, he portrayed a caravan of Central American migrants as a destructive army of potential terrorists. Concluding this effort, his presidential campaign released one of the most flagrantly racist (and starkly dishonest) political ads in recent memory, painting all Hispanic immigrants as murderers and potential murderers.

I thought this was a risky play. Yes, Trump used racist appeals in his 2016 presidential campaign, but they were tied to his interventionist economic message of entitlements, health care, and infrastructure. As president, Trump hasn’t delivered on that full promise. He’s followed through on the racist appeals with punitive immigration and criminal justice policy, but he’s rejected a more liberal approach to the economy, instead embracing Republican orthodoxy with steep tax cuts and a yearlong effort to repeal the Affordable Care Act. It was unclear, from my view, if he could generate similar turnout without a heterodox pitch on the economy.

The results from Tuesday suggest that his strategy might have been an effective one, even if it promises to destroy the country’s social cohesion. Democrats won the House of Representatives, yes, but results in the Senate—and in several races for governor—show how Trump’s gambit paid off. After weeks of relentless demagoguery from the president, the Trump coalition was on war footing, ready to counter an energized Democratic base. Unsurprisingly, President Trump is treating Tuesday as vindication of his race-baiting and a victory for the Republican Party. There’s truth in that analysis. Against a diverse class of Democrats promising economic security, Trump and the GOP fielded a largely white and male phalanx of candidates offering cultural dominance, and in critical places, it worked.

Trump’s strategy supercharged the underlying realignment of the electorate that we’ve been watching since 2016. Urban and suburban voters revolted, producing the Democratic majority in the House and governorships in several states where their turnout can determine outcomes. Rural and exurban whites also turned out, deepening the red color of many of the states Trump won in 2016.

The results from Tuesday suggest that his strategy might have been an effective one, even if it promises to destroy the country’s social cohesion.

There’s an exception to this dynamic: the Midwest. In Iowa, Michigan, Minnesota, Ohio, and Wisconsin, Democrats recovered lost ground thanks to both turnout and persuasion. Candidates there mobilized suburban and urban voters and recouped enough losses with working-class whites to secure wins in critical Senate and gubernatorial races.

You can point to several factors that made the difference for Democrats in those states versus places like Missouri or Florida, where Sen. Claire McCaskill and gubernatorial candidate Andrew Gillum lost their races. Midwestern campaigns capitalized on still-existing labor infrastructure to mobilize union members and bring them back into the Democratic fold. College-educated voters are numerous enough in several of these states to make a key difference, and the president is deeply unpopular with them. And then there’s the provisional nature of white working-class Trump support, which likely swung thanks to the tangible promises of support and benefits that the president reneged on.

The suburban collapse and Midwestern regression tell an important story: that Trump can only count on his base, which hasn’t expanded beyond its narrow demographic confines. But “narrow” isn’t the same as “small.” The president’s racial demagoguery laid the path for several Republican candidates. Republican Ron DeSantis worked hard to tie Gillum, his black opponent, to crime and disorder, and he won the Florida governorship. Indicted congressman Duncan Hunter of California ran a viciously Islamophobic campaign against Ammar Campa-Najjar, an American-born Christian, and won.* Georgia Republican Brian Kemp accused his black opponent, Stacey Abrams, of ties to black radicals and warned of subversion should she win the governor’s mansion, and it’s likely to have worked for him, too.

The problem for Democrats remains the same: Donald Trump’s coalition of rural and exurban whites is large and geographically well-distributed. This has given Republicans an advantage in the Senate, which the party shored up, and it gives Trump a similar advantage in the Electoral College. Plot Tuesday’s statewide results onto a map of the 2020 election and—with Ohio and Florida under his column—Trump is just a stone’s throw from winning re-election.

Make no mistake, Democrats won a victory in the midterm elections. Their newfound House majority represents a substantial majority of Americans who want a significant check on the president. And in building that majority, they’ve increased their gains with college-educated voters and shown how diverse candidates can prevail (or come close) in majority-white electorates. And if the Senate map shows a way forward for the president’s re-election campaign, the House map—and the wide national Democratic majority—suggests Democrats have a real path to unseating Trump in two years.

But Tuesday makes equally clear the Democratic Party must find a response to the president’s political racism. Stoking white fear and resentment works well enough to energize a powerful electoral coalition and secure critical victories, and unless Democrats can push back effectively, they may find themselves losing to Trump for a second time come November 2020. How they do that is an open question, but the success of candidates of color—and the near success of Andrew Gillum in Florida and Stacey Abrams in Georgia—suggests that a direct confrontation with the politics of race and division is possibly the only way forward.

Correction, Nov. 8, 2018: This piece originally misidentified Ammar Campa-Najjar as Muslim. He is Christian.