President Barack Obama has said Republican White House hopeful Donald Trump's insistence that he might not accept the election result is "dangerous".
Speaking at a campaign rally in Miami for Democratic nominee Hillary Clinton, the president said Mr Trump's comments undermined American democracy.
During a televised debate yesterday, Mr Trump refused to say he would accept the outcome of the election on US presidential election on 8 November.
He later said he would accept a "clear" result but left a challenge open.
Speaking in Ohio on Thursday, Mr Trump said, with a grin: "I would like to promise and pledge to all of my voters and supporters and to all of the people of the United States, that I will totally accept the results of this great and historic presidential election - if I win."
In the same speech, he said he would accept a clear election result but reserved the right to file a legal challenge in the case of a questionable one.
Hours later, Mr Obama said that sowing the seeds of doubt in people's minds about the legitimacy of US elections provided a boost to the country's enemies.
"You're doing the work of our adversaries for them, because our democracy depends on people knowing that their vote matters," said Mr Obama.
Mr Trump has been heavily criticised by many in his own party by suggesting he might not accept the election result.
For days, he has claimed the election is rigged against him, due to media bias and voter fraud.
During Wednesday night's debate with Mrs Clinton, when moderator Chris Wallace asked Mr Trump if he would accept losing to her, the Republican nominee said he would "keep you in suspense".
Mr Trump's campaign manager, Kellyanne Conway, later insisted that the candidate had meant he would not concede until the "results are actually known".
Republican Senator John McCain, who lost to Mr Obama eight years ago, said: "A concession isn't just an exercise in graciousness. It is an act of respect for the will of the American people, a respect that is every American leader's first responsibility."
First Lady Michelle Obama also joined the attack on Thursday, saying "you do not keep American democracy in suspense".
At the Ohio rally, Mr Trump also reiterated a claim he made during the debate, that Mrs Clinton and President Obama were responsible for inciting violence at a Chicago rally earlier this year.
The crowd erupted into cheers of: "Lock her up!"
During the debate, he called Mrs Clinton a "nasty woman".
Mr Trump has trailed Mrs Clinton in the polls after facing damaging fallout over a video that emerged of him making obscene remarks about groping women.
When asked to address the allegations made against him by several women in the wake of the video, Mr Trump said the claims had been "largely debunked".
Mr Trump's comments come after a 10th woman came forward to accuse him of sexual assault on Thursday at a news conference.
Karena Virginia said Mr Trump allegedly touched her breast at the US Open in 1998 and made offensive comments about her to a group of men.
The two candidates are scheduled to appear at a charity dinner on Thursday night in New York.
Polls suggest Mrs Clinton is ahead nationally and in key battleground states.