Democrats claimed control of the House late Tuesday and flipped at least seven governorships, but Republicans were poised to expand their majority in the Senate, delivering a split verdict in the first national referendum on Donald Trump’s presidency.

The most expensive and consequential midterm elections in modern times came to a dramatic finish that underscored the nation’s deep polarization, but fell short of delivering a sweeping repudiation of Trump that Democrats had hoped would put an exclamation point on the “resistance” movement.

Trump’s racially charged warnings about illegal immigrants and demonization of Democrats appeared to mobilize enough Republican voters to withstand the “blue wave” the party once feared. The president helped Republicans win hotly contested Senate races in Indiana, Missouri, North Dakota, Tennessee and Texas, and proclaimed the election’s outcome a “tremendous success.” Republicans held their grip throughout the South and in rural and exurban areas.

But Democrats – propelled by a rejection of Trumpism in the nation’s suburbs, and from women and minority voters especially – notched victories in areas that just two years ago helped send Trump to the White House.

In the high-turnout election, Democrats performed well across much of the upper Midwest and even in ruby-red Kansas, where Laura Kelly was elected governor over the president’s handpicked candidate, Kris Kobach. In Wisconsin, Democrat Tony Evers bested Gov. Scott Walker, once a Republican star who ran for president in 2016. Walker survived a hard-fought recall vote in 2012, and was reelected in 2014, only to be denied a third term by the state schools superintendent.

Incumbent Republicans fell in an array of suburban House districts, including the one held by House Rules Committee Chairman Pete Sessions in the Dallas area. And in West Virginia – where Trump is wildly popular and campaigned heavily for Republicans – the reelection of Democratic Sen. Joe Manchin delivered a personal blow to the president.

Advertisement

Competitive Senate races in Arizona and Montana were too close to call.

Returns early Wednesday showed Democrats poised to pick up more than the 23 House seats they needed to gain a foothold in Congress from which to counter Trump. Democrats were projected to flip at least 29 districts currently held by the GOP, while they were on track to surrender only a few seats in the chamber.

With power in Washington divided, House Democrats are likely to try to block the president’s agenda and use their subpoena power to investigate him and his administration.

“Thanks to you, tomorrow will be a new day in America,” said House Democratic leader Nancy Pelosi of California, who is poised to reclaim the speaker’s gavel she lost eight years ago.

The Democratic victory, she said, “is about restoring the Constitution’s checks and balances to the Trump administration,” and a check on Senate Republicans.

The party’s new House majority was propelled by a record number of women candidates. Women currently hold 84 House seats, but that share is projected to expand to 100 or more when all results are tallied. Across the country, 277 women were on the ballot Tuesday for Congress and governorships, an unprecedented number that included 210 House candidates.

Advertisement

But Democrats were disappointed elsewhere. Sens. Joe Donnelly of Indiana, Heidi Heitkamp of North Dakota and Claire McCaskill of Missouri were defeated, while Sen. Bill Nelson’s reelection in Florida appeared in doubt. Republican Marsha Blackburn won the open Senate seat in Tennessee, which Democrats had hoped would slide into their column.

Democrats did pick up a seat in Nevada, where Democratic Rep. Jacky Rosen prevailed over Sen. Dean Heller, the Republican incumbent. The governor’s mansion in Nevada is also set to change hands, as Republican Adam Laxalt conceded to Democrat Steve Sisolak, who is poised to replace the term-limited Brian Sandoval.

Rosen, who by early Wednesday was the lone Democratic challenger to fell a Republican incumbent in the Senate, cast her victory as a counterpoint to the racist and anti-Semitic rhetoric that had marked the closing days of the midterm campaign.

“After all the hate, all the hate that I’ve seen recently, that we’ve all seen, I can’t tell you how much this means to me as a former synagogue president,” Rosen told supporters in Las Vegas.

Two of the liberal movement’s greatest hopes, Democrats Stacey Abrams and Andrew Gillum, struggled to overcome some of the most overt racial attacks since the civil rights era and make history as the first black governors in Georgia and Florida, respectively.

Gillum conceded to Republican Ron DeSantis, a Trump ally, while the Georgia race was too close to call. Early Wednesday morning, Abrams told supporters she would not concede to Republican Brian Kemp and warned that their right to vote was on the line.

Advertisement

“In a civilized nation, the machinery of democracy should work for everyone, everywhere,” Abrams said, alluding to complaints about ballot access and election fairness that have marked her divisive contest with Kemp, who oversees elections as Georgia’s secretary of state. “I’m not going to name names, but some have worked hard to take our voices away.”

Kemp stopped short of declaring victory outright but told supporters, “The math is on our side to win this election.”

If the candidates were to wind up below 50 percent, they would go head-to-head again in a December runoff.

Another Democratic star, Rep. Beto O’Rourke of Texas, lost his spirited challenge to Republican Sen. Ted Cruz despite raising record sums of money and attracting grass-roots support throughout the country.

“All the money in the world was no match for the good people of Texas and the hardworking men and women across our state,” Cruz said in his victory speech.

Midterm elections traditionally are referendums on the party in power, but Trump sought to ensure that this one would be a referendum on his presidency. He told crowds to vote as if he were atop the ballot, warning that his agenda and political movement were at risk, and he made himself the central force with an overwhelming cascade of speeches, media interviews and tweets.

Advertisement

The president returned to his 2016 campaign playbook, delivering fiery speeches that drew massive and enthusiastic crowds but contained a breathtaking barrage of falsehoods, invective and demagoguery. Describing himself in the closing weeks as a “nationalist,” Trump made a caravan of Central American migrants seeking asylum in the United States a dominant theme.

The Senate results underscored just how much the Republican Party has morphed into the party of Trump. The incoming freshman class of Republicans is made up largely of Trump allies – including Mike Braun in Indiana, Josh Hawley in Missouri and Kevin Cramer in North Dakota – who campaigned effectively as rubber stamps for the president’s agenda and owe their new jobs, at least in part, to his energetic campaigning on their behalf.

“Without him, I don’t think we would have had the night we had,” Sen. Lindsey Graham, R-S.C., who has transformed himself from one of the president’s sharpest critics into one of his most stalwart defenders, said on Fox News.

An exception is Mitt Romney, who handily won his race for the open Senate seat in Utah, marking a return to the national stage for the party’s 2012 presidential nominee who in 2016 denounced Trump as a “con man” and a “fraud.” Following the death of Sen. John McCain of Arizona, and the retirements of Sens. Jeff Flake of Arizona and Bob Corker of Tennessee, Romney is poised to become the leading GOP counterweight to Trump on Capitol Hill, if he chooses to stand up to the president.

Romney, the former Massachusetts governor, becomes the first politician in 173 years to serve as governor of one state and then represent another in the Senate. The last to accomplish the feat was Sam Houston, who was Tennessee governor before being elected to the Senate from Texas.

Tuesday’s results were set to transform the House, not only in partisan makeup but also in gender, age and ethnicity. The night marked a series of firsts. Ilhan Omar in Minnesota and Rashida Tlaib in Michigan will become the first Muslim women in the House. Sharice Davids in Kansas and Deb Haaland in New Mexico will become the first Native American women in the chamber. And Alexandria Ocasio-Cortez, a 29-year-old from New York, became the youngest woman elected to Congress.

Advertisement

They were part of a wave of female candidates on the Democratic side, including Jennifer Wexton, who easily unseated Republican Rep. Barbara Comstock in a closely watched race in Northern Virginia, and Debbie Mucarsel-Powell, who narrowly defeated GOP Rep. Carlos Curbelo in South Florida.

“This resistance began with women and it is being led by women tonight,” said Sen. Elizabeth Warren, D-Mass., who easily won reelection and is widely expected to run for president in 2020.

Democrat Jared Polis in Colorado became the first openly gay man elected governor, while Democrat Janet Mills became the first female governor of Maine and Republican Kristi L. Noem will be the first female governor of South Dakota.

Rep. Mia Love, who was the sole black Republican woman in Congress, was trailing in Utah to Democrat Ben McAdams. Republicans were hoping that Young Kim, a Korean American woman, would win her California race to give the party some additional diversity.

Republican-held districts that Hillary Clinton carried in 2016 provided the backbone of the Democratic efforts to win the House majority. Democratic challengers triumphed in a number of suburban areas, defeating Republican Reps. Mike Coffman in suburban Denver, Kevin Yoder in the Kansas City area and David Brat in the Richmond suburbs, among others.

But the Democratic momentum was not strong enough to carry some prized recruits over the finish line. Former Marine fighter pilot Amy McGrath, who attracted significant outside funding, lost to Republican Rep. Andy Barr in Kentucky.

Advertisement

The midterm elections had the energy of a presidential contest in their closing days, with Trump making himself the central figure and hoping to buck the historical trend of major losses for the president’s party in the first midterm vote.

In an all-out push to preserve Republican congressional majorities, Trump dashed from one red state to the next, urging his legions of supporters that he calls “the silent majority” to rush to the polls as if he were on the ballot.

In some ways, the outcome was eerily similar to that of 2016, with late polls overestimating the Democratic advantage in enthusiasm and Republicans showing unanticipated resilience thanks in part to Trump’s incendiary rhetoric and focus on nativist themes.

Racial tensions that had been simmering beneath the surface for years came to a boil in the final weeks of the campaign. Robo-calls in Georgia featured a voice impersonating Oprah Winfrey and calling Abrams “a poor man’s Aunt Jemima.” In Florida, robo-calls mimicked Gillum as jungle sounds and chimpanzee noises were heard in the background.

Trump called Gillum, the mayor of Tallahassee, “not equipped” and Abrams, a leader in the state legislature, “not qualified” to be governors. And Monday, all the major television networks rejected a Trump campaign advertisement about immigration, calling it offensive.

The racial overtones put that explosive form of politics on the ballot, with major stakes for Republicans. The party of Lincoln is now overwhelmingly white, while Democrats have a much more multiethnic coalition that represents the direction the country’s demographics are heading.

Advertisement

Trump closed the campaign on an exceptionally dark note, stoking long-standing national divides on race and culture and painting an apocalyptic and misleading vision of America under Democratic control as he barnstormed key Senate battlegrounds.

Rather than center his closing argument on the country’s robust economic growth, Trump elected to highlight divisive nativist themes in a strategic gamble to energize his conservative base voters.

Because of geographic fate, Democrats always faced an uphill climb in winning the two seats they needed to reclaim the Senate majority. A third of the nation’s senators were up for reelection, including 10 Democratic incumbents running in states that Trump carried in 2016, many of them overwhelmingly. This year’s map gave Republicans the clear advantage of running in conservative states where they had won for decades.

An outlier was Manchin, who secured reelection in West Virginia, which Trump won by 42 percentage points in 2016. He was helped by the independent profile he had cultivated back home, having previously served as governor and sometimes crossing the aisle to vote with Republicans. Manchin was the lone Democrat to vote to confirm Supreme Court Justice Brett M. Kavanaugh last month.

“We made history tonight,” Manchin said with a hoarse voice as he declared victory. “Nobody in the United States has ever won in a state that the president in the previous election won by 42 points in the opposite party. Never happened, never happened.”

In Ohio, another state Trump carried two years ago, Democratic Sen. Sherrod Brown cruised to reelection and cast his victory as a road map for Democrats to reclaim the industrial Midwest, though Republican Mike DeWine won the governorship there.

In two other Midwestern states that Trump won – Wisconsin and Michigan – Democrats fared better than they did in 2016. In Wisconsin, Sen. Tammy Baldwin (D) was reelected. And in Michigan, Sen. Debbie Stabenow won reelection and Democrat Gretchen Whitmer was elected governor.

But Democrats failed to win the governorships in a pair of deep-blue states. Republican Govs. Larry Hogan of Maryland and Charlie Baker of Massachusetts were reelected resoundingly.

Meanwhile, voters in red states demonstrated notable willingness to back progressive policies, as Arkansas and Missouri voted for hikes in the minimum wage. Missouri voters also moved to legalize medical marijuana.