Donald Trump began the week by turning a national scout jamboree into something resembling a youth rally. He ended it in front of more massed ranks in uniform, telling police officers “please don’t be too nice” to suspects they arrest in what sounded to many like an endorsement of police brutality.

And then, amid a blizzard of stories about White House infighting, the chief of staff, Reince Priebus, resigned, becoming the shortest-serving occupant of the post in history. Though Trump seemed blithely unaware of it, it was a fitting finale to the worst week of his short political career.

In five torrid days, the US president alienated conservatives by savaging his own attorney general; earned a rebuke from the Pentagon over a rushed ban on transgender troops; watched impotently as the Senate dealt a crushing blow to his legislative agenda with the fall of healthcare reform; ousted Priebus; and threw a human grenade – the new communications director, Anthony Scaramucci – into his already dysfunctional White House.

“This is certainly the week in which the Trump administration went off the rails,” said Bill Galston, a former policy adviser to Bill Clinton. “And it’s going to require some heavy lifting equipment to get it back on the rails and off down the track.”

Where to start? The most tangible defeat was over healthcare. Trump had repeatedly promised during his campaign to repeal and replace Barack Obama’s signature law, the Affordable Care Act (ACA). But when it came to the tough part, arm-twisting members of Congress or making landmark speeches, the self-proclaimed deal-maker was notably absent.

In the early hours of Friday, after months of wrangling, senators voted on a bill to undo major parts of the ACA, popularly known as Obamacare. In a moment of reality TV suspense that Trump might otherwise have appreciated, John McCain of Arizona, who had returned to the floor after brain surgery, was decisive in sinking the bill.

McCain is an old adversary. The 80-year-old is a decorated navy veteran who was tortured during more than five years of captivity in the Vietnam war. Just over two years ago, Trump, who received five draft deferments, mocked him as “not a war hero”. McCain has become something of a conscience for his party, and country, as Trump tramples and trashes every norm.

His vote – along with those of Susan Collins of Maine and Lisa Murkowski of Alaska – left a seven-year Republican promise in ruins and Trump with zero legislative achievements after more than six months in office. The president had tried to intensify the pressure on Murkowski during the week, tweeting that she “really let the Republicans, and our country, down”.

His interior secretary, Ryan Zinke, phoned Murkowski and her fellow Alaska senator, Dan Sullivan, with a threat to withhold federal support for major economic development projects in the state. The dirty trick failed and Zinke may have cause to regret his actions: Murkowski is chair of the Senate energy and natural resources committee, with power over the interior department’s budget.

Meanwhile, poison was seeping in at the other end of Pennsylvania Avenue. Scaramucci, a mouthy Wall Street financier, publicly declared war on Priebus and Trump’s adviser Steve Bannon in an expletive-laden interview with Ryan Lizza of the New Yorker magazine. He described Priebus as a “fucking paranoid schizophrenic, a paranoiac”, and predicted his imminent demise as chief of staff. Yet far from being punished, “the Mooch” was vindicated on Friday when Priebus confirmed his exit. He will be replaced by Gen John Kelly, who moves over from leading the homeland security department.

Both the president and the communications director have really defiled the temple of our democracy Bill Galston, former Clinton aide

The arrival of Scaramucci was, observers said, the moment the White House went full reality TV. Galston said: “It’s off the charts. Both the president and the communications director have really defiled the temple of our democracy.”

Dangerously for Trump, the critics of Scaramucci’s invective included loyalists such as the former House speaker Newt Gingrich, Fox News and Breitbart, which described the interview as a “rambling rant that was so outrageous and discordant that reporters wondered whether Scaramucci drunk-dialed Lizza, was drunk with power, or reveal[ed] he was unqualified for his communications director job”.

The Trump base had another reason to be upset. The president spent several days publicly humiliating Sessions, his attorney general, over his decision to recuse himself from the investigation into the Trump campaign’s alleged collusion with Russia during last year’s election. Sessions refused to quit, perhaps consoled by conservative voices of dissent.

Kenneth Starr, a former US solicitor general who served as independent counsel in the Whitewater and Monica Lewinsky investigations during the Clinton administration, wrote in the Washington Post: “Mr President, please cut it out. Tweet to your heart’s content, but stop the wildly inappropriate attacks on the attorney general.

“An honorable man whom I have known since his days as a US attorney in Alabama, Jeff Sessions has recently become your piñata in one of the most outrageous – and profoundly misguided – courses of presidential conduct I have witnessed in five decades in and around the nation’s capital.”

Lindsey Graham, a Republican senator from South Carolina, told CNN: “If Jeff Sessions is fired, there will be holy hell to pay.” If Trump tried to fire the special counsel Robert Mueller, Graham added, he would be crossing a “red line”: “Any effort to go after Mueller could be the beginning of the end of the Trump presidency unless Mueller did something wrong.”

Sessions, a hardliner on criminal justice and immigration, is seen as the most Trumpist member of the administration. Taking on the former Alabama senator could prove a huge political miscalculation.

Galston said: “He has managed to alarm and alienate a substantial element of his conservative base. Sessions is the conservative standard-bearer in the administration.”

‘Retired sergeant says transgender ban hurtful’

Trump faced blowback on yet another front. On Wednesday morning he tweeted, out of the blue, that he planned to reinstate a ban on transgender people from serving “in any capacity” in the US armed forces. He claimed he had consulted his “generals” but the Pentagon was blindsided and a day later it pushed back, insisting the policy would not be overturned until it received formal direction.

In a sign of how much America has changed, a decision seemingly calculated to rally the base played badly in media outlets in socially conservative states. The TV station WCIV in Charleston, South Carolina, reported: “Lowcountry transgender veteran ‘stunned’ by President Trump’s transgender military ban”. The Rapid City Journal in South Dakota said: “Retired Ellsworth sergeant says transgender ban hurtful”.

There was also rare defiance from Republicans in Congress. Senator Orrin Hatch, up for re-election soon in Utah, hardly a liberal bastion, said: “I don’t think we should be discriminating against anyone. Transgender people are people, and deserve the best we can do for them.”

After months of bending over backward to accommodate Trump, Republicans gave other indications that they had run out of loyalty or fear. The Senate voted 98-2 to pass a bill increasing sanctions against Russia, Iran and North Korea, blocking Trump’s ability to cut a deal with Vladimir Putin. The White House bowed to political reality and announced that Trump intended to sign the bill.

Ever more isolated, with even Republicans turning against him, Trump went to feed off the dark energy of crowds. But his rambling speech at the National Scout Jamboree in West Virginia was widely condemned as inappropriate for its overt political content (along with a reference to a party with “the hottest people in New York”), prompting an apology from the head of the Boy Scouts of America.

And as all these dramas unfolded simultaneously, handing Trump a week of unmitigated disaster, North Korea conducted a new intercontinental ballistic missile test that landed in the sea off Japan. Experts have warned that North Korea will have the ability to strike the US mainland with a nuclear weapon as soon as next year. It was a sobering reminder of the high stakes facing a White House in disarray.

It’s fair to say Trump has lost control of the narrative Frank Luntz, Republican pollster

Frank Luntz, a Republican pollster and strategist, said: “It’s fair to say Trump has lost control of the narrative. What I don’t know is how and when he can regain it.”

It might have been so different. Figures showed that US economic growth rebounded to 2.6% annual rate in the second quarter. Foxconn, an electronics manufacturer, announced plans to invest at least $7bn in the US and create between 30,000 and 50,000 jobs with a huge factory in Wisconsin. Trump buried his own good news.

Charlie Sykes, a conservative author and broadcaster, said: “It could have been one of his best weeks with the Foxconn announcement. But this has been his worst week ever and everything that has happened has been self-inflicted.

“You have a White House in meltdown because the president is a pyromaniac. The thing that’s got to rattle Republicans is the damage he’s doing to the administration, to the party and to the country.”

Scaramucci is “Trump’s id”, Sykes said. “A friend said to me today, in a rational world, Scaramucci would have been fired for that interview. But in a rational world, Scaramucci would never have been hired. And in a rational world, Donald Trump would not be the president of the United States. We’re well past the rational world.”

It is far from certain whether Trump has actually hit rock-bottom. With Priebus’s departure, he appears to be severing his links to the Republican establishment, even though he will have to work with Congress on tax reform in the hope of a better result than was achieved on healthcare. The potential for conflict between Kelly, a career marine, and Scaramucci seems high. And Trump has not yet been tested by a major international crisis.

Rick Tyler, a political analyst, warned: “It could get a lot worse. North Korea just fired off a ballistic missile today that landed 230 miles from Japan.

“There could be a lot of worse things and we’ll be lucky if we survive them.”