WASHINGTON — Minutes before President Trump was to take the stage in Nashville last week to make his case for the health care overhaul he had promised, he received some unwelcome news that shifted his script.
A Federal District Court judge in Hawaii had just placed another stay on his ban on travelers from six predominantly Muslim countries, dealing his order a second legal setback in two months. As a country music duo crooned in an auditorium still filling with adoring supporters of Mr. Trump, the president fumed backstage and huddled with his staff for a hasty redrafting of the speech.
When Mr. Trump emerged, he decided to relegate the health care overhaul, which he has identified as a top domestic priority, to a brief mention more than halfway through the speech. He instead replaced its prime billing with an angry diatribe against the travel ban ruling and the judge who had issued it.
“I have to be nice, otherwise I’ll get criticized for speaking poorly about our courts,” he said. But he could not help himself: The president soon suggested that the court that had just ruled against him should be destroyed. “People are screaming, ‘Break up the Ninth Circuit!’ ”
Once again, Mr. Trump’s agenda was subsumed by problems of his own making, his message undercut by a seemingly endless stream of controversy he cannot seem to stop himself from feeding.
The health care measure appears on track for a House vote this week, and the president, who planned a weekend of relaxation at Mar-a-Lago, his Palm Beach, Fla., club, is likely to receive a large measure of the credit. But it has also become clear that Mr. Trump, an agitator incapable of responding proportionately to any slight, appears hellbent on squandering his honeymoon.
Instead, he has sowed chaos in his own West Wing, and talked or tweeted his way into trouble, over and over again.
That was never more apparent than over the last week, when fresh questions about his refusal to release his tax returns and the blocking of his executive order sapped the spotlight from his efforts to build support for the health measure and even the unveiling of his first budget.
Even more self-lacerating: his insistence that President Barack Obama had authorized surveillance on his 2016 campaign, a claim that continued unabated despite rebukes from Republicans, denials by the congressional intelligence committees and complaints from the British government, which demanded an apology after Mr. Trump’s spokesman suggested that one of its intelligence agencies had aided in the spying.
“It’s a pattern with him — he sometimes counterpunches so hard he hits himself,” said Ari Fleischer, who served as White House press secretary for George W. Bush.
The public outbursts are mirrored by internal tensions. With the embers of the old rivalry extinguished between his chief strategist, Stephen K. Bannon, and chief of staff, Reince Priebus, a new realignment has emerged in a West Wing already rived by suspicion and intrigue.
Gary Cohn, the former Goldman Sachs executive who serves as the president’s top economic policy adviser and who is decidedly more liberal than the rest of Mr. Trump’s inner circle, is on the rise, and has the ear of the president’s powerful son-in-law, Jared Kushner. Mr. Kushner also gained an ally on the National Security Council with the appointment of Dina Powell, a Republican and another former Goldman official who worked with Mr. Cohn, as a deputy for strategy.
In the newness of the administration, the constant need to tend to internal dynamics has been a distraction. The aides have watched each other warily and tried tending to the president’s base of supporters amid a sea of appointments of people who worked on Wall Street.
Mr. Trump is not bothered by turf battles in his administration. He believes they foster competition and keep any one aide from accumulating too much power. He is even more enthusiastic about waging war publicly, believing that it fires up his white working-class base.
Indeed, in Nashville on Wednesday night, Mr. Trump spoke to a rapturous crowd of almost 10,000 people and his embattled spokesman, Sean Spicer, was greeted as a star by awe-struck supporters, who spent several minutes crowding around him to take pictures and pat him on the back.
But in Washington, some Republican lawmakers and officials have watched in dismay and frustration, they say privately, because the president they are looking to for cover and salesmanship of the health care overhaul keeps getting sidetracked.
One of those diversions came after the judge’s ruling on the travel ban. In Nashville, the president said he would prefer to go back to his first, more restrictive ban and pursue it to the Supreme Court. “That’s what I wanted to do in the first place,” Mr. Trump said, a statement that seems destined to be used against his own lawyers in upcoming court cases on the executive order.
For Mr. Trump, this was supposed to be a week of pivoting and message discipline. The president read from a script during public appearances and posted on Twitter less often. He invited lawmakers from both parties to the White House for strategy sessions on the health measure. He scheduled policy speeches, like one near Detroit, where he announced that he was halting fuel economy standards imposed by Mr. Obama, and the rally in Nashville, where he visited the grave of Andrew Jackson, the populist patron selected by his history-minded political impresario, Mr. Bannon, as Mr. Trump’s presidential analog.
But by Friday, as Mr. Trump worked to call attention to his powers of persuasion in securing commitments from a dozen wavering Republicans to back the health measure, the White House was left frantically trying to explain why Mr. Spicer had repeated allegations that the Government Communications Headquarters, the British spy agency, had helped to eavesdrop on the president during the campaign.
Rather than expressing regret for a slight of one of the United States’ strongest allies, Mr. Trump was unapologetic.
“We said nothing,” he said at a news conference with Chancellor Angela Merkel of Germany. “All we did was quote a certain very talented legal mind who was the one responsible for saying that on television,” he added, referring to Andrew Napolitano, the commentator who first leveled the charge about the involvement of the British intelligence service on Fox News.
That did not seem to be enough for the irate British, who had called the charge “nonsense” and “utterly ridiculous.” Shepard Smith, a Fox News anchor, later disavowed it as well, saying his network could not back up Mr. Napolitano’s claims.
The episode left little time for talk of Mr. Trump’s “America First” budget released on Thursday, filled with domestic spending cuts so deep that even his budget director conceded they would be unpopular, or the health care measure that would affect more than 20 percent of the economy.
“This White House is on two tracks,” Mr. Fleischer said. “The legislative one, which has been surprisingly and pleasantly productive, and the other one full of self-induced error.”
The problem for Mr. Trump, he added, is that the self-destructive behavior, if it continues, threatens to overshadow everything else.
“He has a tremendous number of ingredients at his disposal to be a very successful president,” Mr. Fleischer added, “but he might not even get credit for it if he is so red-hot controversial.”