(Jenny Starrs/The Washington Post)

In deciding to abruptly fire FBI Director James B. Comey, President Trump characteristically let himself be guided by his own instincts — fueled by his creeping anger and sense of victimhood about a probe into Russian meddling in the 2016 election that he considers a “witch hunt.”

The aftermath is a presidency rocked by its most serious self-inflicted crisis yet, exposing dysfunction and distrust within his West Wing and imperiling his agenda. The momentum for the health-care bill that passed the House is gone, and a week scheduled to be devoted to Trump’s preparations for a high-stakes foreign trip was overtaken by distractions and fury.

Across Washington, Trump’s allies have been buzzing about the staff’s competence as well as the president’s state of mind. One GOP figure close to the White House mused privately about whether Trump was “in the grip of some kind of paranoid delusion.”

Trump has been stewing all week, aggrieved by sharp media scrutiny of his decision to fire Comey and of his and his aides’ ever-shifting explanations, and has been quick to blame his staff, according to several people who have spoken with him.

Privately, Trump has lashed out at the communications office — led by press secretary Sean Spicer and communications director Michael Dubke — and has spoken candidly with advisers about a broad shake-up that could include demotions or dismissals. The president personally has conducted postmortem interviews with aides about the Comey saga, investigating the unending stream of headlines he considers unfairly negative, according to several White House officials who spoke on the condition of anonymity because Trump is cracking down on unauthorized leaks.

“This was the first major crisis or test they’ve had, and it looks like a lot of systems failed,” said Chris Ruddy, a Trump confidant and chief executive of Newsmax. “My experience with the president is when he sees failure, he quickly adapts and tries new things. He’s not a guy that keeps the same ol’.”

The system may be failing, but it is Trump who is picking which buttons to press. The president takes pride in being the ultimate decision-maker, for matters large and small. And chaos has been a hallmark of Trump’s enterprises, from his family real estate empire to his presidential campaign, a 16-month venture during which he cycled through three leadership teams.

Inside the White House, there was widespread agreement that Comey had to go. But how and when Trump would fire him — and how it would be rationalized to the public — was the subject of considerable debate.

Vice President Pence, Attorney General Jeff Sessions, senior adviser Jared Kushner, Chief of Staff Reince Priebus and Counsel Donald McGahn were the closest to the president as he weighed his options, according to White House officials.

Would Trump first visit with Comey in person and ask for his resignation or fire him abruptly?

The president decided the latter.

(Peter Stevenson/The Washington Post)

Would Trump slow down the process so that a communications strategy could be crafted, with credible surrogates lined up to defend his decision, or terminate Comey about 24 hours after first telling top aides he wanted it done?

He chose the latter.

Would Trump stick to the agreed-upon explanation for Comey’s ouster or invoke the Russia investigation, both in his Tuesday termination letter to Comey and two days later in a television interview? And would he be restrained on Twitter, as his advisers have urged, or peck out a provocative salvo at Comey warning of possible “tapes” of their private conversations?

In both cases, Trump again chose the less prudent path.

White House aides have felt bewildered and alarmed by how Trump arrives at his decisions — often on impulse and emotion and sometimes by rejecting the counsel of those around him — and how he then communicates those decisions to his personnel and the public. Trump is in some ways like a pilot opting to fly a plane through heavy turbulence then blaming the flight attendants when the passengers get jittery.

The result is a hardening portrait of sheer disarray.

“The Comey firing is just the most dramatic example of a White House that is completely dysfunctional, the most chaotic in modern history,” said Chris Whipple, author “The Gatekeepers,” a newly published history of White House chiefs of staff.

“Reince Priebus has made rookie mistake after rookie mistake,” Whipple said. “But, ultimately, it’s fundamentally on Donald Trump. A chief of staff can do very little to make the White House function if he’s not empowered by his president. That simply has not happened.”

Robert M. Gates, a former defense secretary who informally advised Trump during the transition, criticized his handling of Comey’s ouster.

“Not terribly well done,” Gates told John Dickerson in a CBS News interview scheduled to air Sunday on “Face the Nation.”

“I fired a lot of senior people myself, and I think the key, when you feel compelled to remove a senior official, is essentially to have all your ducks in a row at the beginning,” Gates continued. “To have the rationale, have everybody understand what the rationale was. If possible, to be in a position to announce who is going to step in as the interim immediately. And, if possible, to announce who you’re going to nominate to replace that person.”

As Trump’s anger with the Comey fallout boiled over, his aides have been pointing fingers at one other.

Much of the internal blame has fallen to the communications operation, with Kushner and other top officials questioning why the small army of press staffers led by Spicer and Dubke took so long to forcefully defend the president’s decision and agree to a set of talking points that could withstand scrutiny, according to several White House officials.

Inside the West Wing, it became a running joke among some staffers that the answer to every question would be “Rosenstein,” referring to the deputy attorney general, Rod J. Rosenstein, who wrote a memo outlining a case for Comey’s ouster.

Trump loyalists were particularly upset that Senate Minority Leader Charles E. Schumer (D-N.Y.) organized a news conference Tuesday night and got other Democrats to parrot the same message before a full explanation came out of the White House — despite the fact that the White House controlled every variable of the story.

“They were running around like chickens with their heads cut off,” said one White House official. “There was no leadership, no ‘get your troops in a room, and issue orders and execute.’ ”

Yet Trump did not inform Spicer and Dubke of his decision until about an hour before it was announced, keeping them and other senior aides out of the loop because he feared the news might leak prematurely, officials said.

There is confusion about whether Stephen K. Bannon, the chief strategist who had been somewhat marginalized after feuding last month with Kushner, was among those the president consulted about his decision. Two people familiar with the matter said Bannon intentionally was kept out of the process. But a third person denied that Bannon first learned Comey had been fired from television news reports and said that he had actually counseled Trump to delay his decision to lessen the political backlash.

Spicer and Dubke did not respond to a request for an interview. Their defenders said they were assigned an impossible task of orchestrating on short notice a complete rollout plan — from crafting and distributing talking points to lining up lawmakers, legal experts and other Trump supporters to give interviews.

The explanation delivered Tuesday night by Spicer, counselor to the president Kellyanne Conway and deputy press secretary Sarah Huckabee Sanders — that Trump acted decisively at the recommendation of Rosenstein and Sessions — was discussed with and agreed to by the president himself, officials said.

Trump then changed his story, telling NBC News on Thursday that he made the decision to fire Comey on his own and would have done so “regardless” of Rosenstein’s recommendation.

“We were absolutely given the information that we could have at that time,” Sanders told reporters Thursday. “It was a quick-moving process. We took the information we had, as best we had it, and got it out to the American people as quickly as we could.”

Trump defended his spokesmen, tweeting Friday that they should not be expected to speak with “perfect accuracy” and later complaining to Fox News personality Jeanine Pirro about the “level of hostility” against them. But Trump went on to tell Pirro that he was considering canceling regular press briefings — except for when he does them himself.

Some of Trump’s allies said they are worried that the president views the Comey episode entirely as a public-relations crisis — a branding problem — and has not been judicious about protecting himself from legal exposure as the FBI continues to investigate possible links between his campaign and Russia.

When Trump sat down for the interview with NBC anchor Lester Holt, his aides were not certain what he might say. The president improvised, essentially — and, in one stream-of-consciousness answer, invited potential legal peril by connecting his firing of Comey to the Russia matter.

“In fact, when I decided to just do it, I said to myself, I said, ‘You know, this Russia thing with Trump and Russia is a made-up story, it’s an excuse by the Democrats for having lost an election that they should have won,’ ” Trump told Holt.

Trump also revealed that he had asked Comey on three separate occasions — once over dinner and twice in phone calls — whether he was under investigation by the FBI and said that Comey had told him he was not.

It is Justice Department policy that ongoing investigations generally are not to be discussed with White House officials.

“Trump is so unsophisticated about government, and he lacks even basic knowledge about how the government functions, of what the unwritten but very important rules and traditions are. His attitude toward all those things is they don’t matter: ‘I’m going to drain the swamp!’ ” said a veteran of past Republican administrations who is close to the Trump White House and spoke on the condition of anonymity to candidly critique the president.

Pollster Patrick H. Caddell, a longtime confidant of Bannon who served in Jimmy Carter’s White House, said he was pained to watch the Trump White House struggle.

“It’s like reliving the Carter administration on steroids,” Caddell said. “This is an outsider administration being surrounded by Apache knives. Every inch of the political class and both parties are going after him. The president can’t afford in this type of environment to not execute these kinds of announcements better.”

Damian Paletta and Robert Costa contributed to this report.