US President Donald Trump fired off allegations of election fraud on Wednesday, setting the stage for a potential legal battle, as Democrat Joe Biden took a slim lead in key states that could decide the bitterly contested White House race.

US opinion polls
US opinion polls AFP / STAFF

Americans woke up on Wednesday not knowing who the next US president would be as votes were still being counted in six battleground states that could swing the election.

As Trump vented his frustration on Twitter over the slow vote count, the Biden camp expressed confidence it was on track to win enough of the remaining close state races.

Voters line up to cast early ballots in West Bloomfield, Michigan
Voters line up to cast early ballots in West Bloomfield, Michigan AFP / JEFF KOWALSKY

Campaign manager Jen O'Malley Dillon said a victory by the former vice president was a "foregone conclusion."

Fueling fears of a constitutional crisis, Trump prematurely declared victory overnight and threatened to demand the intervention of the Supreme Court to stop vote-counting.

US President Donald Trump draws another big crowd in Kenosha, Wisconsin
US President Donald Trump draws another big crowd in Kenosha, Wisconsin AFP / Brendan Smialowski

"We did win this election," the 74-year-old president said even before the final vote tallies were complete. "This is a fraud on the American public."

Trump, in a tweet Twitter labeled as potentially "misleading," continued to allege without evidence on Wednesday that there had been instances of fraud.

US President Donald Trump is down in the polls and now has to defend himself from a bombshell report on his tax avoidance
US President Donald Trump is down in the polls and now has to defend himself from a bombshell report on his tax avoidance AFP / MANDEL NGAN

"Last night I was leading, often solidly, in many key States, in almost all instances Democrat run & controlled," Trump tweeted. "Then, one by one, they started to magically disappear as surprise ballot dumps were counted."

There have been no reports of any irregularities and the leads in numerous states have been shifting back-and-forth between the candidates as votes have been counted.

Americans finally vote to choose between four more years of President Donald Trump or his challenger, Democrat Joe Biden
Americans finally vote to choose between four more years of President Donald Trump or his challenger, Democrat Joe Biden AFP / JIM WATSON

Vote-counting has been slow in several states this year because of the coronavirus-related surge in the use of mail-in ballots.

Trump has spent months denouncing mail-in ballots, making unsubstantiated claims that they are liable to fraud.

Democratic candidate Joe Biden says Americans are ready for his calmer presence
Democratic candidate Joe Biden says Americans are ready for his calmer presence AFP / JIM WATSON

The outcome of the White House race appears to hinge on the results from six states where a winner has not yet been declared -- Georgia, Michigan, Nevada, North Carolina, Pennsylvania and Wisconsin.

As of 11:00 am (1600 GMT), Biden had slim leads in Michigan, Nevada and Wisconsin while Trump was ahead in Georgia, North Carolina and Pennsylvania.

The Hale House at the Balsams resort where midnight voting took place as part of the first ballots cast on US Election Day, in Dixville Notch, New Hampshire on November 2, 2020
The Hale House at the Balsams resort where midnight voting took place as part of the first ballots cast on US Election Day, in Dixville Notch, New Hampshire on November 2, 2020 AFP / Joseph Prezioso

But state election officials cautioned that with tens of thousands of ballots outstanding in some states -- millions in others -- the leaderboard could shift.

Voters cast their ballots in Hillsboro, Virginia on Election Day, with President Donald Trump seeking to defy polls and win a second term
Voters cast their ballots in Hillsboro, Virginia on Election Day, with President Donald Trump seeking to defy polls and win a second term AFP / ANDREW CABALLERO-REYNOLDS

Trump had a roughly 500,000 vote lead in Pennsylvania with an estimated 78 percent of the vote counted but votes were awaited from heavily Democratic parts of the state.

Democratic presidential candidate Joe Biden speaks to supporters in Philadelphia, Pennsylvania
Democratic presidential candidate Joe Biden speaks to supporters in Philadelphia, Pennsylvania AFP / Angela Weiss

"We have to be patient," Pennsylvania Governor Tom Wolf said. "We may not know the results today.

"There are millions of mail-in ballots," he said. "They're going to be counted accurately and they will be counted fully."

A Trump supporter tries to run from demonstrators at Black Lives Matter plaza across from the White House on Election Day
A Trump supporter tries to run from demonstrators at Black Lives Matter plaza across from the White House on Election Day AFP / Olivier DOULIERY

The Democratic governor shrugged off criticism from the White House over the slow vote count and said "our democracy is being tested in this election."

"Pennsylvania will have a fair election," he said. "And that election will be free of outside influences."

Biden vowed on Wednesday to ensure that no American was disenfranchised.

"We won't rest until everyone's vote is counted," the 77-year-old former vice president said on Twitter.

The Biden campaign also slammed Trump's victory claim as a "naked effort to take away the democratic rights of American citizens."

"If the president makes good on his threat to go to court to try to prevent the proper tabulation of votes, we have legal teams standing by ready to deploy to resist that effort," it said.

Trump "will be in for one of the most embarrassing defeats a president ever suffered before the highest court in the land" if he asks it to invalidate ballots counted after Election Day, said former White House counsel Bob Bauer, a lawyer for Biden's team.

The tight White House race and recriminations evoked memories of the 2000 election between Republican George W. Bush and Democrat Al Gore.

That race, which hinged on a handful of votes in Florida, eventually ended up in the Supreme Court, which halted a recount while Bush was ahead.

The US Elections Project estimated total turnout at a record 160 million voters including more than 101.1 million early voters, 65.2 million of whom voted by mail.

In an election that took place under the shadow of the coronavirus pandemic that has claimed more than 230,000 lives in the United States, Trump appeared to have avoided a Democratic wave predicted by some polls.

But as of Wednesday afternoon neither candidate had captured the 270 votes needed for victory in the Electoral College that determines the winner of the presidential race.

Trump's premature declaration of victory was met with criticism from some of his Republican allies.

"Stop. Full stop. The votes will be counted and you will either win or lose. And America will accept that. Patience is a virtue," tweeted Adam Kinzinger, a Republican congressman who won reelection.

"I disagree with what he did tonight," said former New Jersey governor Chris Christie, who helped Trump prepare for his first debate against Biden.

"There's just no basis to make that argument tonight," Christie told ABC News. "There just isn't."

While there were no immediate reports of unrest, stores have been boarded up throughout the capital Washington.