WASHINGTON (AP) — Facing tremendous headwinds and weighty history, Democrats fought Republicans to a stunning midterm draw.

Many Democrats went into election night dreading how bad their losses could be and pondering how to explain them. By Wednesday, they had quickly shifted into day-after hoping that they could actually maintain a voting majority in the Senate, celebrating victories in key governors’ races, and aware that control of the House was still not declared.

Republicans were left grumbling about “candidate quality.” Several candidates refused to concede in races that The Associated Press had called for their opponents.

The final numbers might not be known for weeks. There’s still a chance Republicans could take unified control of Congress, and President Joe Biden’s ambitions for the next two years would instantly shrink. The nation’s fractious political divides remained on vivid display.

Democrats had plenty to savor in the morning light. But as they exhaled and Republicans lamented big gains that didn’t materialize, there were larger problems that both political parties will need to address — and soon.

For the Republicans, Donald Trump and his conspiracy-laden politics were exposed anew as a problem, one that this time likely blocked his party from achieving much bigger gains in a nationwide election. Instead of celebrating a red tsunami on Wednesday, Republicans faced a new round of infighting over Trump’s role in the GOP and the red wave that wasn’t.

“Every Republican in America this morning is waking up sick to their stomach,” said Republican strategist David Urban, a former Trump adviser. “Live by Trump, die by Trump.”

Whether that assessment is overheated will play out in the coming weeks, starting next Tuesday, when Trump has promised a “major” announcement. Most available evidence shows he is still the most powerful figure in his party.

Given the political and economic climate, it should not have been difficult for Republicans to make major gains Tuesday. Polling showed voters were deeply pessimistic about the state of the economy and the direction of the nation. President Biden’s approval ratings were anemic. And history strongly suggested that any party holding the White House would bear the brunt of voter discontent.

But in several key races, the candidates backed by Trump stumbled.

In battleground Pennsylvania, Democrats won contests for Senate and governor against a pair of Trump loyalists who embraced his lies about the 2020 election. Democrat John Fetterman pushed past concerns about his health and his progressive policies to defeat Mehmet Oz, the celebrity TV doctor Trump picked from a crowded Republican primary field this spring. Trump defender Doug Mastriano was headed toward double-digit defeat in the governor’s race.

Colorado Rep. Lauren Boebert, one of Trump’s loudest cheerleaders in Congress, was locked in a close race with the final votes being counted.

It was much the same in Georgia, where Trump’s hand-picked Senate nominee, former football star Herschel Walker, was running essentially tied with Democratic Sen. Raphael Warnock even as Republican Gov. Brian Kemp, whom Trump opposed, cruised to reelection.

“Clearly, we lost races we should have won because Trump picked flawed candidates,” said Republican strategist Alex Conant. “Georgia should have been a slam dunk.”

“Trump’s challenge,” Conant added, “is that with every loss, his opposition grows stronger.”

Indeed, as Trump-backed candidates flailed, Florida Gov. Ron DeSantis, a potential 2024 presidential rival who was not endorsed by Trump, scored a resounding victory.

But for Democrats, a could-have-been-worse election night was not the same as a great one.

With several key races still too early to call, the Republican Party may still win control of the House of Representatives for the next two years of Biden’s presidency. And with that, the GOP could block the passage of any meaningful legislation while launching independent investigations — even impeachment proceedings — with impunity.

And while the Democrats avoided a political wipeout, some of the places they lost exposed deepening cracks in the racially diverse working-class coalition that has fueled their victories for years. It may be weeks or months before the exact extent of those cracks is known, but there is little doubt they are there.

Look no further than south Florida’s Miami-Dade County, an overwhelmingly Hispanic former Democratic stronghold that DeSantis, a Republican, won as he cruised to reelection. Without Miami-Dade, Democrats have little path to future victories in a state that has been a perennial presidential battleground.

“It’s just a reality. There’s a universe of Latinos and African Americans who are voting Republican at a higher level for lots of reasons,” said Democratic pollster John Anzalone, whose clients include Biden.

Democrats also lost suburban voters across New York and Virginia. In other districts, their candidates eked out victories in districts Biden had carried easily. They lost Hispanic communities across south Texas. And they lost in working-class regions across the Midwest, including Ohio, where moderate Democrat Tim Ryan failed to defeat Trump-backed Republican JD Vance.

Overall, Democrats struggled to find a clear, compelling message, jumping from abortion to the economy to Social Security and back to abortion.

Even before polls closed, Third Way, a group led by moderate Democrats, issued an ominous warning about the party’s damaged brand.

“While it might be comforting to blame any midterm losses solely on historical trends … there is a much deeper problem at play,” Third Way wrote in a memo. “Ultimately, there is no way for Democrats to build and maintain winning coalitions without repairing their damaged brand, even in an era where Republican candidates are increasingly extreme and women’s fundamental rights are on the ballot.”

Despite such concerns, history suggests Democrats should have had a much worse night.

Trump’s GOP lost 40 House seats in the 2018 midterms. Former President Barack Obama’s party lost 63 in 2010. Going back to 1934, the party that occupies the White House has lost on average 28 House seats and four Senate seats.

“We can’t let the whiners and bedwetters win,” Anzalone said. “If you’re facing historically bad headwinds and should have major losses, but you’ve made these races incredibly close, then there are a lot of key races where the Democratic messaging was working.”

___

EDITOR’S NOTE — National Political Writer Steve Peoples has covered national politics for The Associated Press since 2011.

___

Follow AP’s coverage of the elections at: https://apnews.com/hub/2022-midterm-elections

Check out https://apnews.com/hub/explaining-the-elections to learn more about the issues and factors at play in the 2022 midterm elections.

___