Historians may one day conclude that the extraordinary 2016 US election was decided in early August when Donald Trump suffered one of the most politically calamitous weeks ever to befall a presidential nominee.
Mr Trump's devastating wounds were mostly self-inflicted and arose from a series of gaffes, petty feuds, and xenophobic comments that left even some of his own supporters wondering if it was too late to replace him.
It began when the billionaire picked a fight with the parents of Captain Humayun Khan, a Muslim US soldier who died a hero in Iraq in 2004 at the hands of a suicide bomber.
Khizr Khan, his father, had spoken at the Democratic Convention at the end of July, lambasting Mr Trump over his proposal to ban Muslims from entering the US. Mr Trump could not let it pass and in response, on national television, he implied that Mr Khan's wife Ghazala had not been allowed to speak publicly because of the couple's Muslim faith.
Those and subsequent comments sparked outrage across American society and in the military, one of Mr Trump's own core constituencies. Republican leaders begged him to apologise but he would not.
Perhaps even more damaging was Mr Trump's refusal for several days last week to endorse Paul Ryan, the most senior Republican official, who is seeking re-election to Congress.
Mr Trump, apparently motivated by a personal feud, sparked a near civil war in his own party. His own running mate Mike Pence contradicted him and endorsed Mr Ryan. Reince Priebus, chairman of the party, attempted to recruit Mr Trump's children to stage an "intervention" to change his mind.
Mr Trump then made gaffes that included not knowing Russia had taken the Crimean Peninsula two years ago. He savaged Japan, suggesting if the US was attacked, the Japanese would "sit home and watch Sony television".
A former ally also alleged that Mr Trump had asked three times in a foreign policy briefing why he couldn't use nuclear weapons as president.
When asked which women he would put in the Cabinet, the businessman could name only one, his daughter Ivanka. To cap it off, he told a mother with a crying infant at one of his rallies to "get the baby out of here".
Abandoning traditional decorum President Barack Obama launched a five-minute diatribe in the White House East Room, calling the property mogul "unfit and woefully unprepared" for office. Michael Morell, former acting head of the CIA, called him an "unwitting agent" of Vladimir Putin because of his pro-Russian policies. There were few things worse that a presidential candidate could be called. Yet members of his own party did find worse.
Joe Scarborough, a former Republican congressman turned talk show host, said he had received many calls about the billionaire's mental health.
Karen Bass, a Democratic congresswoman, launched an online petition calling for Mr Trump to undergo a mental health evaluation to judge if he is "mentally fit to lead the free world", suggesting he may have Narcissistic Personality Disorder (NPD).
On Friday night Mr Trump responded to attacks on his state of mind. He told a rally in Wisconsin it was Mrs Clinton who was "pretty close to unhinged" and an "unbalanced person".
Polls at the end of his terrible week showed Mr Trump sinking to a perhaps insurmountable 15 percentage point deficit against Mrs Clinton. Suggestions emerged that Mr Trump's advisers had no control over him; campaign staff were said to feel they were "wasting their time" and their mood was described in one leak as "suicidal".
Paul Manafort, Mr Trump's campaign chief, denied such reports but pointedly said that "the candidate is in control of his campaign".
The fear for Republicans was that Mr Trump's growing unpopularity could have a knock-on effect on other races in November, leading the party to lose control of the Senate. Party insiders were exploring what the contingency would be if Mr Trump left the fray. According to Rule 9 of the Republican rulebook, if the nominee steps down for "reasons of death, declination, or otherwise" the Republican National Committee can replace him. The word "otherwise" is not defined.
Should a move be made to replace Mr Trump against his will he would certainly sue, and any coup would have to occur before the end of August.
The major gaffes in the worst week of the Republican hopeful's campaign
July 31: Feud with Khizr Khan
Mr Trump picks a fight with the father of a Muslim US soldier who died as a hero in Iraq. America sides overwhelmingly with Mr Khan. The backlash is perhaps the worst of Mr Trump's entire campaign.
Aug 1: Crimea
Mr Trump raises eyebrows in a TV interview saying he would not let Vladimir Putin into Ukraine, two years after Mr Putin seized the Crimean Peninsula.
Aug 2: Paul Ryan row
Mr Trump petulantly refuses to endorse Paul Ryan, the most senior Republican, in his re-election bid for Congress, causing a near civil war in his own party.
Aug 2: Purple Heart
After accepting a Purple Heart medal from a US veteran, Mr Trump inappropriately jokes it was a "much easier" way to get one than earning it.
Aug 3: Intervention
Reince Priebus, the Republican chairman, tries to enlist Mr Trump's children in a reality show-style "intervention" to get him back on message.
Aug 3: Iran video
Mr Trump claims to have seen a "top secret" video of the US delivering $400?million to Iran. Two days later he is forced to make a rare admission that he was wrong.
Aug 3: Staff suicidal
Unsubstantiated reports emerge suggesting that Mr Trump's advisers have lost control of him and staffers are "suicidal".
Aug 3: Baby feud
At one of his rallies Mr Trump is interrupted by a crying baby. He tells the mother: "Get the baby out of here."
Aug 3: Nuclear weapons
A former Trump ally claims the billionaire asked three times in a foreign policy briefing: "If we have nuclear weapons, why can't we use them?"
Aug 3: Cabinet women
Asked which women he would put in the Cabinet, Mr Trump could only name his daughter Ivanka.
Aug 4: Sexual harassment comments
Asked what he would do if his daughter Ivanka was sexually harassed at work, Mr Trump said she should quit and "find another career or company".
Aug 5: 15 points behind Clinton
A national poll shows Mr Trump at his lowest point yet, dropping below 40 per cent in support, after polls in three swing states show him at least nine points down.
Aug 5: Russian agent
In an astonishing and unprecedented attack, Mike Morell, former acting head of the CIA, calls Mr Trump an "unwitting agent" of the Kremlin.