Democrats won unified control of the federal government Wednesday, after two U.S. Senate runoffs in Georgia were called in their favor just as a mob of rioters allied with President Trump invaded the Capitol building, destroying property, injuring police officers and disrupting the finalizing of President-elect Joe Biden’s victory.

With almost all of the votes counted, Democrat Raphael Warnock was leading Sen. Kelly Loeffler, a Republican appointed to the seat, by 1.6 percentage points, or over 73,000 votes. In the second contest, Democrat Jon Ossoff led by just under one percentage point, or nearly 36,000 votes, over David Perdue, a Republican whose Senate term expired on Sunday.

Both Warnock’s and Ossoff’s leads Wednesday were larger than the 0.5 percentage point threshold in Georgia that allows a candidate to request a recount. Their leads were expected to grow, given the location of the outstanding ballots, according to Edison Research, which projected the victories.

The victories give Democrats a 50-50 split of the chamber, with the tie vote to be cast by Vice President-elect Kamala D. Harris.

For Biden and his fellow Democrats, the results were a stunning and unexpected boon — the party’s House majority shrank precipitously as a result of November’s voting, and the president-elect has faced an onslaught of attempts to overturn the results by Trump and his supporters. Had Republicans maintained control, his priorities could have been quashed by the Senate.

“Georgia voters delivered a resounding message yesterday: they want action on the crises we face and they want it right now,” Biden said in a tweet congratulating Ossoff and Warnock on their victories.

But the party’s celebration was cut short by the surreal spectacle of a violent assault on the legislative seats of power. Paired with the latest Republican failure at the ballot box, it highlighted Trump’s chaotic approach to governing that Republican strategists blamed for their losses in the Georgia senate contests.

The party had never made a secret of its three-part plan to win the two Georgia Senate runoffs. Republicans wanted to scare suburban voters about the “radical socialist” designs of the Democratic candidates, argue the merits of maintaining divided government under Biden, and use Trump to turn out non-college-educated White voters en masse.

But Trump’s obsession with his own political future, which was on full display Wednesday as he implored his supporters to head to the Capitol to protest Biden’s win, undermined each part of the plan in the final weeks of the campaign, according to Republican strategists involved in the race.

Not once did the president write a tweet in his own voice attacking the two Democrats in the race, Warnock and Ossoff. Trump traveled only twice to the state during the runoff campaign, for speeches that largely focused on his own grievances against state Republican leaders.

He sought to convince voters in the state that he had won the November election, when he had not, undermining the argument that the Senate needed Republican control to serve as a check on Biden, which internal GOP polling showed was the most potent way to win swing voters.

“Trump made us look crazier than Democrats are,” said one strategist involved in the races, who spoke on the condition of anonymity to avoid backlash from Trump loyalists. “We did not make any new improvements in the suburbs. At some point you just get tapped out on the Trump base.”

Those failures, combined with a massive Democratic effort in the state to turn out Black and Hispanic voters, produced two historic upsets that will reshape the country. Warnock, who leads the Rev. Martin Luther King Jr.’s former church in Atlanta, will be the first Black Democrat elected to the Senate from a former Confederate state. Ossoff, a 33-year-old Jewish filmmaker who previously interned for Rep. John Lewis (D-Ga.), the late civil rights icon, will be the youngest incoming senator in decades.

The results capped a rapid fall from power of the political movement that Trump founded, taking over the Republican Party and then winning the White House in 2016. Since then, Republicans have lost control of the House and the Senate, and Trump lost his own reelection bid, as deep divisions have formed among lawmakers in his party.

Just before the Ossoff race was called, Vice President Pence announced he would defy Trump’s demands that he single-handedly move in Congress to overturn the results of the 2020 election. Senate Majority Leader Mitch McConnell (R-Ky.) also delivered an impassioned rejection of Trump on the floor of the U.S. Senate, all but calling the president’s efforts an assault on the country he had sworn to serve.

“If this election were overturned by mere allegations from the losing side, our democracy would enter a death spiral,” McConnell said, in a historic condemnation of Trump’s intent. “We would never see the whole nation accept an election again.”

McConnell will now serve as minority leader as Biden takes office on Jan. 20, giving Biden greater leeway to confirm Cabinet nominees and judicial picks, and pass legislation on taxes, spending and immigration that Democrats have promised to champion.

The results also raised new questions about the fate of the Republican Party after Trump’s exit. The party has increasingly leaned more and more on structural advantages in gerrymandered districts and advantages in the U.S. Senate map and electoral college, as they redoubled their appeal to the interests of a core group of evangelical Christians and non-college-educated Whites.

The strategy has allowed several narrow wins in recent decades, but it has also exposed the party’s growing weaknesses in states like Arizona and Georgia, both won by Biden.

“If Republicans continue to manage their party by simply talking to the base and not trying to expand the circle, they are going to have problems in 2022,” said J.B. Poersch, the president of the Senate Majority PAC, which spent about $100 million for Democrats in the Senate runoffs. “The thing about the last two weeks is Republicans were knee deep in the process. It was all about navel-gazing and taking the temperature of Trump’s emotional state.”

Ossoff underscored the point in a statement Wednesday when he declared victory.

“This campaign has been about health and jobs and justice for the people of the state, for all the people of the state,” Ossoff said. “Whether you were for me or against me, I’ll be for you in the U.S. Senate. I will serve all the people of the state.”

For the moment, Trump continues to hold enormous sway over the Republican Party. Multiple Republican strategists who played prominent roles in the recent election declined to speak on the record about their misgivings about Trump’s behavior because they did not want to attract criticism from his supporters.

“He was focused on conspiracies and not on an opportunity to actually win,” said a second frustrated Republican involved in the Georgia contests, who spoke on the condition of anonymity for those reasons. “He could have won the race and headlines would have been that Trump is back and he is coming for Biden in four years.”

Instead, the election result in Georgia may point to the growing political sway of Biden, who has recently embraced the promise of passing a $1,400 increase in pandemic-related stimulus payments for most Americans. Trump had highlighted the issue by demanding the same increase in payments, opposed by McConnell and Senate Republicans, even as he campaigned for the party’s candidates.

Democratic internal polling in Georgia found support for McConnell among Republicans and independents fell in late December as Democrats pushed for the higher payments. Both Perdue and Loeffler supported the increase but could not promise a path to delivering it.

“You have both Democrats in this race zeroing in on getting money back in people’s pockets, getting covid under control, and zeroing in on the idea that we can actually get things done in Washington,” said a senior Biden adviser, speaking on the condition of anonymity because they were not authorized to speak publicly. “That was a dominant message for Biden, and this showed that he’s got coattails and he’s got political muscle. The message of this campaign — the general and the special elections — laid down a road map for Democrats going forward.”

Since 1992, Georgia has held eight statewide runoff elections between Democrats and Republicans, with Republicans winning seven of them. In each, turnout decreased significantly from the general election, and in all but one, Republicans expanded their vote margin. But Tuesday’s races did not follow that pattern.

The Democratic margins among voters under the age of 30 grew sharply from November, according to exit polls, as did the Democratic margins for Hispanic and Black voters, especially Black male voters. Democrats broadly credited a program helmed by Stacey Abrams, a former gubernatorial candidate in the state, for driving the increased political involvement.

“I can’t help but stand in awe of African American turnout in rural areas,” Poersch said.

Strategists for both parties said Republicans were also likely hurt by Trump not being on the ballot himself, which bodes poorly for Republicans in the 2022 midterm elections.

“This guy is a cult leader. And there’s a certain percentage who are only going to come out for the cult leader,” said John Anzalone, an Alabama-based Democratic pollster who worked for Biden.

Like others in the party, he hopes that the outcome both in November and in the Georgia midterms could point to a more lasting realignment for the country.

“We’re seeing that if Republicans are seen as obstructionists during a pandemic, Republicans could potentially be punished,” Anzalone said. “If Democrats are getting small businesses and families things that they need and Republicans are obstructionists, I think that Democrats could buck the historical trend.”

That concern is widely shared among Republicans, who remain hopeful that they can regain control of the House and Senate in 2022. But there were other signs Wednesday that Republicans may be looking for an alternate path forward to the polarization and recrimination that has marked Trump’s approach.

“We cannot keep drifting apart into two separate tribes with a separate set of facts and separate realities, with nothing in common except our hostility toward each other and mistrust for the few national institutions that we all still share,” McConnell said, shortly before the Senate chamber was invade by a mob of Trump supporters organized around the false notion that Trump won the election.

Speaking from Wilmington, Del., Biden delivered a similar message.

“Today’s a reminder, a painful one, that democracy is fragile and to preserve it requires people of goodwill, leaders with the courage to stand up, who are devoted not to the pursuit of power and personal interest at any cost, but to the common good,” he said.

Matt Viser and Scott Clement contributed to this report.