Democrat Joe Biden defeated President Donald Trump to become the 46th president of the United States on Saturday, positioning himself to lead a nation gripped by a historic pandemic and a confluence of economic and social turmoil.

His victory came after more than three days of uncertainty as election officials sorted through a surge of mail-in votes that delayed the processing of some ballots. Biden crossed 270 Electoral College votes with a win in Pennsylvania.

Joe Biden

Trump refused to concede, threatening further legal action on ballot counting.

Biden, 77, staked his candidacy less on any distinctive political ideology than on galvanizing a broad coalition of voters around the notion that Trump posed an existential threat to American democracy. The strategy proved effective, resulting in pivotal victories in Michigan and Wisconsin as well as Pennsylvania, onetime Democratic bastions that had flipped to Trump in 2016.

Biden, in a statement, said he was humbled by the victory and it was time for the battered nation to set aside its differences.

“It’s time for America to unite. And to heal,” he said.

“With the campaign over, it’s time to put the anger and the harsh rhetoric behind us and come together as a nation,” Biden said. “There’s nothing we can’t do if we do it together.”

Biden was on track to win the national popular vote by more than 4 million, a margin that could grow as ballots continue to be counted.

Trump was not giving up.

Departing from longstanding democratic tradition and signaling a potentially turbulent transfer of power, he issued a combative statement while he was on his Virginia golf course. It said his campaign would take unspecified legal actions and he would “not rest until the American People have the honest vote count they deserve and that Democracy demands.”

Trump has pointed to delays in processing the vote in some states to allege with no evidence that there was voter fraud and to argue that his rival was trying to seize power — an extraordinary charge by a sitting president trying to sow doubt about a bedrock democratic process.

Kamala Harris also made history as the first Black woman to become vice president, an achievement that comes as the U.S. faces a reckoning on racial justice. The California senator, who is also the first person of South Asian descent elected to the vice presidency, will become the highest-ranking woman ever to serve in government, four years after Trump defeated Hillary Clinton.

Trump is the first incumbent president to lose reelection since Republican George H.W. Bush in 1992.

Early Saturday he left the White House for his Virginia golf club dressed in golf shoes, a windbreaker and a white hat as the results gradually expanded Biden’s lead in Pennsylvania.

Trump repeated his unsupported allegations of election fraud and illegal voting on Twitter. One of his tweets, quickly flagged as potentially misleading by Twitter, claimed: “I WON THIS ELECTION, BY A LOT!”

In Wilmington, Delaware, near a stage that has stood empty since it was erected to celebrate a potential victory on Election Night, people cheered and pumped their fists as the news that the presidential race had been called for the state’s former senator arrived on their cell phones.

On the nearby water, two men in a kayak yelled to a couple paddling by in the opposite direction, “Joe won! They called it!” as people on the shore whooped and hollered. Biden was expected to take the stage for a drive-in rally after dark.

There were scenes of celebrations in some big cities across America, including New York. And a crowd thronged the recently christened “Black Lives Matter” plaza in Washington to cheer just a few blocks from the White House.

Americans showed deep interest in the presidential race. A record 103 million voted early this year, opting to avoid waiting in long lines at polling locations during a pandemic. With counting continuing in some states, Biden had already received more than 74 million votes, more than any presidential candidate before him.

Trump’s refusal to concede has no legal implications. But it could add to the incoming administration’s challenge of bringing the country together after a bitter election.

Throughout the campaign, Trump repeatedly refused to commit to a peaceful transfer of power, arguing without evidence that the election could be marred by fraud. The nation has a long history of presidential candidates peacefully accepting the outcome of elections, dating back to 1800, when John Adams conceded to his rival Thomas Jefferson.

More than 236,000 Americans have died during the coronavirus pandemic, nearly 10 million have been infected and millions of jobs have been lost. The final days of the campaign played out against the backdrop of a surge in confirmed cases in nearly every state, including battlegrounds such as Wisconsin that swung to Biden.

The pandemic will soon be Biden’s to tame, and he campaigned pledging a big government response, akin to what Franklin D. Roosevelt oversaw with the New Deal during the Depression of the 1930s. But Senate Republicans fought back several Democratic challengers and looked to retain a fragile majority that could serve as a check on such Biden ambition.

The 2020 campaign was a referendum on Trump’s handling of the pandemic, which has shuttered schools across the nation, disrupted businesses and raised questions about the feasibility of family gatherings heading into the holidays.

The fast spread of the coronavirus transformed political rallies from standard campaign fare to gatherings that were potential public health emergencies. It also contributed to an unprecedented shift to voting early and by mail and prompted Biden to dramatically scale back his travel and events to comply with restrictions. Trump defied calls for caution and ultimately contracted the disease himself. He was saddled throughout the year by negative assessments from the public of his handling of the pandemic.

Biden also drew a sharp contrast to Trump through a summer of unrest over the police killings of Black Americans including Breonna Taylor in Kentucky and George Floyd in Minneapolis. Their deaths sparked the largest racial protest movement since the civil rights era. Biden responded by acknowledging the racism that pervades American life, while Trump emphasized his support of police and pivoted to a “law and order” message that resonated with his largely white base.

The president’s most ardent backers never wavered and may remain loyal to him and his supporters in Congress after Trump has departed the White House.

The third president to be impeached, though acquitted in the Senate, Trump will leave office having left an indelible imprint in a tenure defined by the shattering of White House norms and a day-to-day whirlwind of turnover, partisan divide and the ever-present threat via his Twitter account.

Biden, born in Scranton, Pennsylvania, and raised in Delaware, was one of the youngest candidates ever elected to the Senate. Before he took office, his wife and daughter were killed, and his two sons badly injured in a 1972 car crash.

Commuting every night on a train from Washington back to Wilmington, Biden fashioned an everyman political persona to go along with powerful Senate positions, including chairman of the Senate Judiciary and Foreign Relations Committees. Some aspects of his record drew critical scrutiny from fellow Democrats, including his support for the 1994 crime bill, his vote for the 2003 Iraq War and his management of the Clarence Thomas’ Supreme Court hearings.

Biden’s 1988 presidential campaign was done in by plagiarism allegations, and his next bid in 2008 ended quietly. But later that year, he was tapped to be Barack Obama’s running mate and he became an influential vice president, steering the administration’s outreach to both Capitol Hill and Iraq.

While his reputation was burnished by his time in office and his deep friendship with Obama, Biden stood aside for Clinton and opted not to run in 2016 after his adult son Beau died of brain cancer the year before.

Trump’s tenure pushed Biden to make one more run as he declared that “the very soul of the nation is at stake.”