Brendan Smialowski / Getty

Democrats recaptured control of the House of Representatives Tuesday, ending eight years of Republican control and dealing President Donald Trump a stiff rebuke.

With most results in, Democratic candidates either had won or were leading in enough districts to win the 23 seats needed to capture the chamber and then some—perhaps ending up with as much as a 20-seat edge. The question now is how big the Democratic advantage will be when results from all races are in. The outcome is in line with early predictions, though early returns Tuesday suggested that the scale of Democratic victories might be smaller than anticipated, and some pundits declared the hope of a blue wave dead. Yet despite tough losses for Democrats in Senate and gubernatorial races, the House has shaped up about as well as the party could have hoped.

The Democratic takeover of the House will reshape the terrain in Washington, providing a genuine counterweight to Trump for the first time in his presidency and breaking the unified Republican control of the House, Senate, and White House. While it will be all but impossible for Democrats to actually turn any of their priorities into law, House control provides them a position to conduct strict oversight of the Trump administration and to further bog down an already sclerotic presidency.

“Tomorrow will be a new day in America,” Representative Nancy Pelosi, the leading candidate to be the next speaker of the House, told Democrats at a party in Washington. “Today is more than about Democrats and Republicans. It’s about restoring the Constitution’s checks and balances to the Trump administration. It’s about stopping the GOP and Mitch McConnell’s assaults on Medicare, Medicaid, the Affordable Care Act, and the health care of 130 million Americans.”

The Democratic wins on Tuesday came across the country, in traditionally Democratic districts and in ones that Trump captured in 2016. They came in cities, suburbs, and even some rural areas. They came in traditionally progressive states but also in locales where Democrats have become a rare, exotic species in the modern era, such as Kansas and Oklahoma. Democrats also showed their strength in suburban districts, expanding their dominance from urban areas to outlying constituencies that Republicans have controlled.

Three wins in Virginia showcase the Old Dominion’s recent emergence as a solid Democratic state. In addition to Tim Kaine’s easy victory in the U.S. Senate race, the first flipped seat of the night featured Jennifer Wexton handily defeating Barbara Comstock in Northern Virginia’s 10th District. Comstock is a longtime Republican soldier, and the party poured millions of dollars into the race, but it was unable to save the two-term representative. Elaine Luria also beat Scott Taylor in the 11th District. But the most astonishing result came in the strongly conservative Seventh District, where the former CIA agent Abigail Spanberger defeated Dave Brat. Brat, an extremely conservative Republican, entered Congress in 2014 after beating Republican Majority Leader Eric Cantor in a GOP primary. Now the seat is in Democratic hands.

Pennsylvania is another bright spot. Democrats had expected to win the state  in 2016, but it favored Trump. Earlier this year, the state supreme court ordered new congressional districts to be drawn, saying that the old maps were the result of an unconstitutional partisan gerrymander. The new maps were far more favorable to Democrats, who netted three new seats in the state.

Democrats picked up two seats in Florida, including in the 27th District, where former Secretary of Health and Human Services Donna Shalala survived a late scare. In eastern Iowa, the celebrated young Democrat Abby Finkenauer beat the veteran Republican Rod Blum. Republican incumbents Peter Roskam and Randy Hultgren were tossed out in Illinois, too. Democrats won two seats in Minnesota, three seats in New Jersey, and three in New York, including on Staten Island, a GOP stronghold in deep-blue New York City.

In some cases, Democrats won in places where they have seldom had much luck in recent cycles. In Kansas’s Third District, Sharice Davids beat Kevin Yoder. Kendra Horn defeated Steve Russell in Oklahoma’s Fifth. The veteran Texas Republican Pete Sessions lost to Colin Allred in a Dallas-area district, and Lizzie Fletcher unseated John Culberson in a constituency that has been held by Republicans since George H. W. Bush won it in 1966. Michigan’s Rashida Tlaib and Minnesota’s Ilhan Omar made history as the first two Muslim women elected to the House.

In total, Democrats are poised to pick up 30 to 35 seats. The results could have been even bleaker for Republicans. Democrats are projected to win the popular vote in the House by some 9 percent, but favorable districts for Republican candidates give them a built-in edge. Democrats had also hoped for a clean sweep through strongly Republican districts, but saw the “blue wave” wash up short in districts such as Kentucky’s Sixth, where Andy Barr stopped his challenger, Amy McGrath. Several controversial Republicans also survived. Duncan Hunter of California and Chris Collins of New York, both of whom are under criminal indictment, appear to be on a path to victory, as is Steve King of Iowa, whose racist comments and actions led the National Republican Congressional Committee to withdraw financial support for him late in the campaign.

Yet on a night of heartbreaking losses for Democrats in the Senate and a mixed bag in governor’s races, House candidates came through for them.

The Republican losses are in line with both historical precedent and most predictions. The president’s party typically loses seats during midterm elections—though Trump has spoken boldly of defeating the pattern—and Democratic voters have shown surprising strength in special elections since 2016. By the eve of voting, the leading analysts all expected a Democratic edge. The question was how large it would be.

While every race has its own specific circumstances, there’s no mistaking the major factor in the Democratic win: Donald Trump. The president said he was on the ballot, and voters appear to have agreed, according to exit polls. While Democrats wrestled with how to speak about him on the campaign trail and in ads, his influence is visible in the results. Democrats competed in districts that Trump won handily in 2016, including in the Rust Belt and even in deep-red Texas. Preliminary data show that turnout was exceptionally high among minorities and youth voters compared with recent midterm elections. In some cases, Trump’s personality and style were a factor. In others, his policies, especially his attempts to dismantle the Affordable Care Act, proved a powerful issue for Democratic candidates. Democrats also enjoyed exceptionally strong fund-raising.

During the summer of 2018, Trump was predicting a “red wave,” a retort to predictions of a “blue wave,” though as Election Day approached, he backed off that prediction, telling the Associated Press in October that he would not accept blame if Republicans lost the House, and saying this week that he was concentrating on preserving the GOP advantage in the Senate, acknowledging the prospect of losing the House.

As the results became clear Tuesday night, Trump tweeted:

The president also called Pelosi to congratulate her. Yet despite his effort to put a brave face on the results, it’s a bad night for Trump. While Republicans scored big victories in the Senate and in several hotly contested gubernatorial races, the Democratic House is likely to be a particular irritation to the president himself.

The Democratic victory ends a brief period of unified Republican control of government, including the White House, the House, the Senate, and effectively the Supreme Court. The House has been in Republican hands since the 2010 Tea Party wave. As The Washington Post notes, this is the third time control of the chamber has flipped in the past 12 years, a level of vacillation not seen since the immediate post–World War II period.

Republicans hand over the gavel with a decidedly mixed record. They successfully stymied much of President Barack Obama’s agenda from 2011 on, but they largely failed to further conservative priorities. Federal spending continues to grow; entitlements have not been cut; Obamacare remains in place, though scaled back; and after aiming for a tax-code overhaul, they had to settle for temporary tax cuts. Much of that class of 2010 has left the House or is leaving this year, and the party is also losing its leader. Wisconsin’s Paul Ryan, hailed as one of the GOP’s brightest young thinkers, was reluctantly thrust into the speakership, but opted to retire this year, apparently tired of being caught between the unpredictable and often outrageous president and a fractious caucus.

It’s likely that the Democratic leader, at least initially, will be a familiar face: former Speaker Nancy Pelosi. Although a growing number of Democrats have chafed against her leadership, and some won election this year promising not to vote for her, she remains the heavy favorite to reclaim the gavel—at least to begin. Pelosi has been eager to reclaim the speakership, after serving in that role from 2007 to 2011, but has said she is likely to be a “transitional” leader, paving the way for a new Democratic speaker in the near future.

Given Republican control of the Senate and White House, Democrats will have little chance to enact their policy priorities. Where they are likely to make their biggest impact is in oversight of the White House. The majority means Democratic chairs of committees will have subpoena power, and are likely to deluge the Trump administration with requests for documents and testimony on a range of issues. They could demand to see the president’s tax returns. They could even attempt to impeach him.

For Trump, the frustration will not end there. He’s never enjoyed working with Congress, and has expressed frustration at the slow pace of both chambers. Having the opposition party in control of the House will create further gridlock. If there’s a silver lining for the president, though, it’s that a Democratic House will create a useful foil for him as he runs for reelection in 2020.

We want to hear what you think about this article. Submit a letter to the editor or write to letters@theatlantic.com.