Democrats hoping that Tuesday’s midterm elections would deliver them the antidote to Trumpism had to settle instead for medicine that might curb its most damaging side effects.

The party regained control of the House of Representatives, giving them subpoena power to now investigate everything from Russia’s meddling in the 2016 election to President Donald Trump’s personal finances. But it fell short in the Senate, giving the president the numbers he needs to continue reshaping the country’s judiciary and to appoint cabinet members of his liking.

The mixed result left some Democrats despondent and others buoyant and foreshadowed two years of bitter partisan warfare in the run-up to the 2020 presidential election.

Inside their victory party at the Hyatt Regency, a few blocks away from the Capitol, Democrats celebrated their return to congressional power and pledged to wield it strategically. Rep. Jerry Nadler (D-NY), who stands to chair the House Judiciary Committee, told CNN he planned to look into everything from the administration’s family separation policy to gun safety. Others echoed that call.

“It means a lot more responsible oversight,” Rep. Don Beyer (D-VA) told The Daily Beast. “I don’t think we’re going to have Benghazi Jr. I don’t think it’ll be vindictive. But there have been so many things that have needed just responsible exploration.”

But across town, the mood inside the White House and its nearby events center—the Trump International Hotel—was similarly upbeat. By 9 p.m., Marc Lotter, former top spokesman for Vice President Mike Pence and a current member of Trump’s 2020 advisory board, was all smiles, saying that it was “too early to tell” but that the evening’s signs were at least “positive” for Democrats’ chances of actually managing to blow it. As 9:30 pm rolled around, and even Fox News began to start giving cues that Democrats would take the House at least by a hair, those smiles had dimmed, but only a bit. One West Wing official told The Daily Beast that the Democratic Party would get what it wants: a cavalcade of “investigation after investigation” into Trumpworld. But the official said that they, along with several others in the administration’s top ranks, had been planning for just that. “Expect witch hunts,” the official said, cheekily, echoing a Trumpian trope.

The administration had reason to feel good about the results.

The Republican Party appeared poised to pad its margins in the Senate, which would allow it to continue confirming conservative judges and give the president some leeway to replenish his cabinet with more supportive members. Chief among the changes likely to come will be the replacement of Attorney General Jeff Sessions, who reportedly will leave his office soon after the election. The prospect of Trump appointing someone new, who could then take over oversight of Special Counsel Robert Mueller’s probe into Russia meddling, loomed large as the Senate results trickled in.

Perhaps as importantly, Trump emerged from Tuesday’s results well positioned politically. The Republicans who had lost their seats were mostly moderates—the types who would have felt most emboldened to break with the president. More to the point, his party had secured the governorships in key electoral states—Ohio, Florida, and Iowa—proving the durability of his political appeal heading into the re-election.

Even top Democrats conceded that this wasn’t a temporary problem for the party and instead was another sign of a “realignment” that began in 2016.

“White, non-college-educated voters are trending more and more Republican,” said one former top Democratic campaign staffer. “It seems Gillum and Cordray couldn’t do much to expand African-American turnout beyond Hillary. Obama performed better with non-college education white voters and did a better job turning out African-American voters.”

The staffer added, “Until we find candidates who can do both those things, these states will be hard to win.”

For Democrats, Tuesday’s victories were hardly inconsequential. The party made massive inroads in suburban districts, ended two years of unchecked Republican power, saw gains in governors races, won control of several statehouses, and achieved clear victories on voter rights initiatives, including the restoration of voting rights to more than a million former felons in Florida. And by taking over the House, it effectively bottlenecked any legislative efforts that the Trump administration was hoping to pursue in the next two years: from further dismantling of Obamacare (though much of that can still be done through executive action) to additional tax cuts or environmental and banking de-regulation.

"It’s about restoring the Constitution’s checks and balances to the Trump administration," House Democratic Leader Nancy Pelosi (D-CA) declared in her victory speech.

But strategists also conceded that serious questions confront the party going forward, chief among them what lessons it should divine about the campaigns and candidates it needs to run in Trump-won states and districts. A progressive Democrat lost a Senate race in Texas and a gubernatorial contest in Florida. Moderate Democrats lost races in North Dakota, Missouri, Indiana and Tennessee.

Ken Baer, a former top Obama administration official, argued that the party’s main failure was in expectation setting; that the Senate map was always going to be unfavorable to the party and that leadership should not have built up hope for wins in tough races. In an otherwise successful night for the party, Democrats should not have left feeling gloomy. “Social media divorces you from reality,” Baer said.

But others were less sanguine, with one top official wondering if the party had erred in not making the election even more about Trump (as opposed to a monomaniacal focus on health care) after the president stepped in to declare that he was on the ballot in the election’s closing weeks.

“This is a lot like 2010 in reverse,” said another Dem operative, in reference to how House Republicans fared during Barack Obama’s first mid term election. “We flipped the House in a big way. “Republicans held on to the Senate. Dems picked up a bunch of governor’s races. Gerrymandering just dented our raw house pickups.”

Reminded that Obama went on to win re-election two years after that contest, the operative replied: “Well, we can’t nominate a Democratic Mitt Romney.”

Gideon Resnick, Asawin Suebseang and Lachlan Markay contributed reporting.