After a night of high political drama and many bitten-down fingernails, the results of the midterms turned out broadly as expected. Riding very high voter turnout and a wave of female and suburban revulsion at Donald Trump, the Democrats seized control of the House of Representatives, making a net gain of at least twenty-six seats. The Democrats also won hotly contested gubernatorial races in Kansas, Illinois, Michigan, and Wisconsin. In the Senate, where most of the elections held were in Trump country, the Republicans expanded their majority, knocking off Democratic incumbents in Indiana, Missouri, and North Dakota.

If this sounds like a split verdict, that is partially right. In helping to defeat Democratic senators in deep-red states that he carried easily in 2016, Trump demonstrated again the grip that he and his inflammatory agenda have on certain segments of the electorate and certain parts of the country. (Anyone who doubted this was kidding himself.) He was surely delighted, also, to see Republicans win the Florida gubernatorial race and take a narrow lead in the Florida Senate race, which was still too close to call early this morning.

This was enough for Trump to proclaim victory, but consider the items on the other side of the ledger. The Senate map was heavily stacked in the Republicans’ favor, and the result in Nevada was a significant setback for them. The G.O.P.’s losses in gubernatorial races, which included defeats for Kris Kobach, in Kansas, and Scott Walker, in Wisconsin, marked an important reversal of the Party’s recent hegemony at the local level. And the Democratic victory in the House was bigger than it appeared on the basis of the seat tally.

According to a projection by the Times early this morning, the Democrats were set to win the popular vote by seven percentage points. That would nearly match the margin the Republicans achieved in the 2010 midterms, which Barack Obama famously described as “a shellacking.” Only the rampant gerrymandering of the past few decades contained the size of the Democratic majority.

Moreover, the Democrats virtually swept the congressional races in New York and New Jersey, strengthening their stranglehold in the Northeast. They also did very well in other parts of the country, including California, Illinois, Michigan, Texas, and Virginia. Some of the individual results were stunning.

In Virginia’s Seventh District, which runs north from Richmond, Abigail Spanberger, a former C.I.A. operative, defeated Dave Brat, the former Tea Party darling who is one of the most conservative members of Congress. In Illinois’s Sixth District, which has been Republican since the nineteen-seventies, Sean Casten, a Democratic businessman, unseated the former Republican chief deputy whip Peter Roskam. Even more remarkable was the result in Illinois’s Fourteenth, another largely white, suburban district, where Lauren Underwood, a thirty-two-year-old African-American nurse who made health care the central issue of her campaign, defeated the four-term G.O.P. incumbent Randy Hultgren.

The sight of seats like this one going Democratic should be alarming to Republican strategists. So should the results of Senate races such as the one in Arizona, where the Democrat Kyrsten Sinema appears to have narrowly lost to the Republican Martha McSally, and, in Texas, where Beto O’Rourke came within three percentage points of defeating Ted Cruz. The G.O.P. cannot exercise power in the long term if it loses control of the Sun Belt and the northern suburbs.

Equally, it can’t prosper without winning more support among women and young people, two groups that find Trump highly toxic. In House races, according to the CNN exit poll, the Democrats carried the female vote by nearly twenty points—fifty-nine per cent to forty per cent. In the eighteen-to-twenty-nine age group, Democratic candidates led their Republican opponents by thirty-five points; in the thirty-to-forty-four demographic, Democrats won by nineteen points. More than ever, the Republicans are a party of middle-aged and elderly white males.

Put all this together, and Tuesday’s elections represented a significant rebuke to Trump. Not a killer blow, to be sure, but one that will have immediate consequences for him and his Presidency. “Thanks to you, tomorrow will be a new day in America,” Nancy Pelosi, currently the House Minority Leader, told a crowd at the Democratic headquarters in Washington, shortly before midnight.

Pelosi also said that the Democratic win in the House was about “restoring the Constitution’s checks and balances to the Trump Administration,” and about protecting Medicare, Medicaid, and the ability of people with preëxisting conditions to get insured. Before the new Congress convenes, in January, the Democratic leadership will have to make some awkward decisions about which part of this quote to emphasize: going after Trump or focussing on policy issues.

For now, though, let’s concentrate on what just happened. Ever since November, 2016, many people, myself included, have worried about the health of American democracy, and some have speculated that Trump could be the death of it. As long as he remains in office, acting like a mob boss on some days and an arsonist on others, the danger will be there. And the results in the Senate could even embolden him. But, at least on Tuesday, the American people exercised their right to inflict some big defeats on his party. That was a win for democracy and a loss for Trump.