President Barack Obama has said Republican 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.
Mr Trump refused in a televised debate to say he would accept the outcome of the 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, the president 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”.
With the Clinton camp – Kim Ghattas, BBC News
Hillary Clinton walked on to her campaign plane to the cheering and clapping of her aides.
She told reporters she was relieved and grateful and joked there would be “no more naps”- a reference to Trump’s repeated description of her prep days off the campaign trail as naps.
Mrs Clinton’s stand-in for Mr Trump during the mock debates was one of her close aides, Philippe Reines, who took the role so seriously that he wore Trump cufflinks, shoe lifts and the same red tie as Mr Trump. After the debate, Mrs Clinton and Mr Reines embraced and he called her a “badass hombre”.
Clinton aides said she would continue to highlight Mr Trump’s refusal to pledge he would accept the results of the election. But would it be a real crisis on election day? Not if the result was a decisive win, they seemed to quietly indicate.
If Mrs Clinton and her team felt that she had closed the deal on stage, they kept their confidence in check. But the mood on the plane was certainly relaxed.
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.