Election Night 2018 wasn’t looking to be an especially promising one for Republicans. GOP operatives and pollsters had resigned themselves to Democrats retaking the House of Representatives after eight years in the minority. How big of a margin was tough to predict, but the ultimate result wasn’t really doubt. There were simply too many toss-up races in suburban districts, political terrain that had become increasingly adversarial to President Donald Trump. Republican incumbents were being badly out-raised by their Democratic challengers, many of whom were riding high on a tsunami of enthusiasm the likes of which the party had not experienced since Barack Obama’s “hope and change” election in 2008. Two weeks before the polls opened on November 6, the Center for Responsive politics calculated that the Democratic Party had raised $2.5 billion this cycle, $300 million more than the GOP.

More cash doesn’t automatically translate into more House or Senate seats, however. Fortunately for the Democrats, there was a correlation during Tuesday’s midterms. Democrats needed a net gain of 23 seats to turn the color of the House from red to blue, and as of the time of this writing, the party was well on their way to meeting that number—and then some. House Republican incumbents representing the suburbs would have preferred to discuss the nation’s economic growth and the GOP-passed tax cuts during the last several weeks of the campaign, a good news story that a governing party could have safely ran on. President Trump, however, had different ideas. To the president, playing up the national security danger of a caravan of illegal immigrant invaders was far more exciting than discussing tax policy. When the night was over, Republicans like Kansas’s Kevin Yoder, Florida’s Carlos Curbelo, Colorado’s Mike Coffman, Virginia’s Barbara Comstock, Texas’s Pete Sessions, and New York’s John Faso all lost their jobs.

If Democrats had a terrific night in the House, the party dug itself into a deeper hole on the other side of the Rotunda. Because the Senate map was so horrific for the Democrats this year—10 Democratic incumbents were running in states that Trump carried in 2016—the chances of a Democratic takeover of the upper chamber were about as slim as winning the lottery: sure, it could happen, but it wasn’t likely. And so it was for the Democrats last night: Indiana’s Joe Donnelly, North Dakota’s Heidi Heitkamp, Florida’s Bill Nelson, and Missouri’s Claire McCaskill were all defeated by their Republican challengers despite spending tens of millions of dollars on television advertising and campaign literature. Nancy Pelosi may be waiting to take the speaker’s gavel for a second time, but the Senate will be run by Mitch McConnell for at least the next two years.

For President Trump, election night was a mixed result. Losing the House is surely an embarrassment for a man obsessed with portraying himself as excelling at everything he puts his mind to. But it could have been far worse. Democrats, for example, could have taken both chambers of Congress, which would have not only completely shuttered Trump’s legislative agenda but gummed up the advise-and-consent machinery for the remaining two years of his term. The only thing worse than a Democratic-run House for the president would have been a Democratic-run Senate that ritually blocked his cabinet appointments and judicial nominations. With Republicans expanding their Senate majority, at least Trump will be able to continue transforming the judicial system into a bastion of conservative jurisprudence. Indeed, imagine just how more of a mess Brett Kavanaugh’s conformation process would have been for the administration if the Democratic Party were in the majority.

The House will now be at the center of the #Resistance in Washington. Democrats will wield committee chairmanships and subpoena power, and you can bet that several major investigations will be launched against the administration when the next Congress is officially sworn in. The GOP Senate, however, will provide the White House with an ally on Capitol Hill and a formidable check on whatever bills soon-to-be Speaker Pelosi jams through the chamber.

At the risk of sounding melodramatic, the United States has never been as divided politically as it is right now. There are people who worship Donald Trump as if he were the pope, a man who can do no wrong and who deserves to be supported every step of the way. But there are also Americans who are incredibly distressed about the country’s state at this moment. To the progressives who populate Alexandria Ocasio-Cortez’s Bronx/Queen district or Nancy Pelosi’s San Fransisco haven, Trump may be the most dangerous president the American republic has ever had in its history.

After tonight’s split decision, the next two years could very well be even more divisive than the last two.

Daniel R. DePetris is a foreign policy analyst, a columnist at Reuters, and a frequent contributor to The American Conservative.