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.