Congressional Democrats began a period of reckoning Wednesday after another political debacle left them suffering losses to their House majority and clinging to a narrow path to Senate control, a stark contrast to the strong optimism of a “blue wave” that would repudiate President Trump and his allies on Capitol Hill.

As the presidential race headed toward a photo finish, House Speaker Nancy Pelosi (D-Calif.) and Senate Minority Leader Charles E. Schumer (D-N.Y.) faced a political letdown that, so far, resembled their failure in 2016 when Trump was elected.

In the highly anticipated ­Senate matchups, Republicans scored easier-than-expected victories in Iowa, Kansas, Texas, Maine, Montana and South Carolina while establishing narrow but steady leads in Georgia and North Carolina.

Democrats’ slim chance at claiming the majority appears to rest on Joe Biden clinching the presidential race and Sen. David Perdue (R-Ga.) falling below his state’s legally required 50 percent threshold, which would set up two runoff elections on Jan. 5 in Georgia that, if Democrats won both, would deadlock the Senate at 50-50.

Sen. Lindsey O. Graham (R-S.C.) held his Senate seat on Nov. 3, despite being out-fundraised by Democrat Jaime Harrison. (Reuters)

In that scenario, once Sen. Kamala D. Harris (D) was sworn in as vice president, she would provide the Senate’s tie-breaking vote, handing the chamber to Schumer.

House Democrats struggled to come to grips with how they managed to lose seats after Pelosi and party strategists predicted gains of 10 or more that would give them commanding control over the chamber.

Instead, they appear to be headed to the smallest House majority in 18 years.

Former Colorado governor John Hickenlooper (D) is projected to defeat Republican Sen. Cory Gardner. (John W. Hickenlooper via Facebook)

Privately, Democratic operatives acknowledged that they missed the mark in their projection models — something that also occurred in polling from GOP outlets and media companies — saying Trump had run much stronger than expected in the conservative terrain and boosted Republicans down ballot.

“We’re going to have to figure out how to get the message to resonate with the rural voters,” said Michelle Smith, chairwoman of the Jasper County Democratic Party in Iowa. “Trump blew it out of the water here. It’s embarrassing.”

Beyond that angst among the strategist class, elected Democrats began a predictable circular firing squad. Centrists blamed their far-left colleagues who have promoted “revolution” and ambitious policies such as Medicare-for-all and the Green New Deal, while those liberals punched back at the establishment for embracing a tepid agenda that did little to inspire the activist class.

“Democrats need to do some soul-searching here,” said Rep. Kurt Schrader (D-Ore.), a veteran centrist. “We’re way out in left field, and the inner core of the American voter kind of knows that.”

Rep. Mark Pocan (D-Wis.), an influential liberal, disagreed. “Maybe the problem was actually that Medicare-for-all wasn’t on the ballot yesterday. Perhaps we should be examining how progressive policies like legalizing cannabis and raising the minimum wage won big,” he said, noting that those policies prevailed in states Trump carried. “Progressive policies have always been popular policies, but it’s our job to bring them to the American people.”

For their part, Republicans credited their surprise showing to Trump’s stronger-than-expected performance combined with a line of attack against swing-district Democrats that tied them to the most liberal wing of the House caucus, the self-described socialist democrats in “The Squad,” as first-term Rep. Alexandria Ocasio-Cortez (D-N.Y.) dubbed them two years ago.

“The choice is going to be between freedom and socialism,” Rep. Tom Emmer (Minn.), chairman of the National Republican Congressional Committee, told reporters Wednesday, summing up the strategy he mapped out last year.

“Overall, we had a better election than most people thought across the country,” Senate Majority Leader Mitch McConnell (R-Ky.) told reporters Wednesday in his home state.

McConnell also blamed some Democrats for getting ahead of themselves by embracing policies such as eliminating the legislative filibuster and increasing the size of the Supreme Court, issues that Senate GOP incumbents used to paint their Democratic opponents as too extreme.

If Biden wins and Republicans hold the Senate, he would be the first president since George H.W. Bush to enter the White House without his party controlling both the House and Senate. That would leave Biden’s Cabinet picks and other appointments in the hands of McConnell, who mocked “my old friend” Biden for flirting with ideas such as court expansion.

With McConnell in charge, those proposals would be dead on arrival, and any Democratic hopes of expanding the Affordable Care Act or passing voting rights legislation would face significant obstacles.

Neither Pelosi nor Schumer made any public appearances Wednesday, although Pelosi expects to hold her weekly news briefing Thursday in the Capitol.

In a letter to colleagues late Wednesday, the speaker said the Biden-Harris ticket will have enough votes to win and focused on collaboration with a new administration, but she made no mention of a possible Republican-led Senate stopping the agenda.

“Our Democratic House Majority, working in partnership with the Democratic White House, will now have the opportunity to deliver extraordinary progress,” she wrote. “Together, we will continue to deliver on our successful For The People agenda: lower health care costs, bigger paychecks by building green infrastructure and cleaner government.”

Democrats say they do not believe either leader will face a serious challenge, although disappointment with the party’s ­direction cuts across all ranks.

Schumer made a round of calls ahead of Tuesday’s vote to shore up his position as leader, at a time when he hoped it would be for a promotion to majority leader, according to two Democrats familiar with the calls who spoke on the condition of anonymity to discuss the private talks.

After steering Democrats to a 40-seat gain and the majority in the 2018 midterms, Pelosi fought off some internal rebels who wanted a new generation of leadership and spent the past two years consolidating her power like never before. However, with Tuesday’s losses, some Democrats say the 80-year-old, who has run the caucus for 18 years, should signal she will end her rein in 2022.

“This will be the last term for her as speaker,” said Schrader, who fought with Pelosi in the past but pledged to support her for another two years. At that point, he wants her and her two deputies, Majority Leader Steny H. Hoyer, 81, and Majority Whip James E. Clyburn, 80, to step aside.

“It is time to move on,” he said.

Rep. John Yarmuth (D-Ky.), an outspoken liberal, also said Pelosi should make clear this will be her last term, particularly if there is a GOP-led Senate that will create legislative gridlock for the next two years.

“I think she has to be much more definitive about a transition, because I think that going into the 2022 midterms, that if she’s still the face of the party in the Congress, that’s not going to be good for us unless we accomplish great things,” Yarmuth, chairman of the House Budget Committee, said. “But I assume it’s going to be basically a relatively unproductive Congress.”

Tuesday’s results surprised some Republicans as much as Democrats. Just last Thursday, officials at the National Republican Senatorial Committee gave an inside look at how bad the political environment was, amid a pandemic that has left more than 230,000 Americans dead and an economy reeling, with Trump performing far worse than his 2016 campaign in states ranging from ruby-red Kansas to Democratic-leaning Colorado.

Add in record-setting fundraising for many Democratic Senate candidates who had no previous public profile, along with Emmer’s NRCC scaling back its resources to play defense in GOP terrain, and Democrats believed they could deliver a knockout blow to “Trumpism” not just with a Biden victory but also a decisive rebuke to the president’s congressional allies.

Instead, the nation cleaved into rural-exurban and suburban-urban enclaves, leaving some Democrats in unfriendly territory overly exposed.

In a Montana race Democrats poured tens of millions of dollars into, for example, Sen. Steve Daines (R) won by roughly 10 percentage points, a comfortable margin as Trump’s early polling woes gave way to a projected victory of more than 15 percentage points over Biden there.

In Georgia, Perdue’s campaign floundered in the closing weeks and caused panic at the NRSC and a super PAC aligned with McConnell, but by late Wednesday, Trump and Perdue were both around 50 percent, although neither race was officially called.

If Perdue drops below 50 percent, he would face a runoff against Democrat Jon Ossoff, joining Sen. Kelly Loeffler (R) and Raphael Warnock (D), who are headed to the Jan. 5 runoff in a special election in Georgia.

In only one state, as of now, did presidential support shift from its pick for the Senate — Maine, where Sen. Susan Collins (R) scored a projected victory of more than seven percentage points over Democrat Sara Gideon.

A highly touted recruit of Schumer, Gideon raised twice as much money as the 24-year incumbent but could not even force Collins into the state’s complicated ­second-ballot ranked-choice system. She called Collins on Wednesday afternoon to concede defeat.

Late Wednesday, Collins had almost 40,000 more votes than Trump in Maine, where Biden and the state’s two House Democrats scored relatively comfortable wins.

Democrats, as they look through the wreckage in congressional races, will be left to wonder how little they were able to make health care a central issue in voters’ minds, something that proved pivotal in their favor two years ago.

According to exit polls, just 10 percent of voters ranked that issue as their top concern, below the economy (first, at 33 percent), racial justice (20 percent) and the coronavirus.

Emmer said voters seemed more concerned about jobs than about public health, siding with Trump’s push to open the economy rather than focusing on safety first, as Biden has urged.

“It did not play the way they thought it would play,” he said of the pandemic.

Erica Werner in Washington and Mark Guarino in Pella, Iowa, contributed to this report.