John Kelly, the new White House Chief of Staff, told Stephen Bannon in late July that he needed to go: No need for it to get messy, Kelly told Bannon, according to several people with firsthand knowledge of the exchange. The two worked out a mutually amicable departure date for mid-August, with President Donald Trump’s blessing.

But as Trump struggled last week to contain a growing public furore over his response to a deadly, race-fuelled melee in Virginia, Bannon clashed with Kelly over how the President should respond. Give no ground to your critics, Bannon urged the President, with characteristic truculence.

At the same time, New York real estate investor friends told Trump that the situation with Bannon was untenable: Steve Roth on Monday, Tom Barrack on Tuesday and Richard LeFrak on Wednesday.

By Thursday, after Bannon undercut US policy toward North Korea in an interview published by a left-leaning magazine, Trump himself had concluded that Bannon was too much of a liability.

By Friday, when he was forced from his job as Trump’s chief strategist, Bannon had found himself wholly isolated inside a White House where he once operated with such autonomy that he reported only to the President himself.

This account is based on interviews with a dozen White House aides, associates of the President’s and friends of Bannon’s.

A former naval officer, Bannon speaks often in the language of combat — of escalating conflict to “nuclear” levels and driving his enemies “ballistic.” But in the end, he had lost the war against a list of enemies that included nearly everyone in the West Wing. They included not just the adversaries whose conflicts with Bannon were widely aired — Gary D. Cohn, the President’s chief economic adviser; Lieutenant General H.R. McMaster, the national security adviser; Ivanka Trump, the President’s daughter; and Jared Kushner, his son-in-law.

Also against him was Kelly, who was outraged by the indiscretion Bannon displayed in the interview with The American Prospect, according to three senior administration officials. And Bannon could no longer turn to Trump, whose confidence in him had eroded over a period of months, to ask for a reprieve.

Even the market tumbled on the prospect that Bannon could come out on top. Blue chip stocks slid last week after an erroneous report said that Cohn’s resignation was imminent because of his disgust with Trump’s failure to more forcefully denounce the racist Charlottesville, Virginia, demonstrators. Friends and former colleagues of Cohn’s said the economic adviser criticised Trump in such strong terms that at least one wondered how he could possibly remain in his position.

As soon as Bannon arrived at the White House on Inauguration Day, he seemed to realise that he would not be long for the job. He felt that Trump had treated him as a peer during the presidential campaign, but, he often complained to friends, “when I got to the White House, all of a sudden I was just a staffer.

The mythology around Bannon held that he was the evil genius who pushed the President to make some of his more audacious decisions. And Bannon’s political opponents believe his departure has removed one of the biggest impediments to stability inside the White House.

But more likely, Bannon’s exit will clarify that only one person, Trump, for better or worse, has always been his own chief strategist. While several administration officials interviewed said they see Kelly as perhaps the last hope for fixing the fractured administration, they concede that only Trump can right his listing presidency.

“My view is that the President has his own mind,” said Matt Schlapp, chairman of the American Conservative Union and a former White House political director under George W. Bush. “People make too much of the idea that he’s some kind of blank slate that advisers can push one way or the other.”

Steve Schmidt, who helped manage Senator John McCain’s presidential campaign in 2008 and is a critic of the President, said: “We are seeing all of the personal qualities and character of the president on a daily basis. It’s not restrainable or controllable because he is who he is.”

Bannon’s opponents had long argued that he inflated his importance in White House debates and took more than his fair share of credit in plotting Trump’s victory. But he was someone with whom the president, for the most part, had long enjoyed spending time.

The two men, whose friendship was cemented during the 2 1/2 months in which Bannon helped rescue Trump’s presidential campaign, reinforced each other’s rough-around-the-edges tendencies. Both could be gratuitously foul-mouthed, viciously cutting to their enemies and unapologetically politically incorrect. “Dude, he’s Archie Bunker,” Bannon would say with fondness when talking about Trump.

Bannon fed Trump’s paranoid streak and shared the President’s penchant for believing in conspiracies. He viewed not just intelligence agencies but most of government as stocked with a devious bureaucratic underbelly, the “deep state.” Trump, who has never worked in government, eagerly adopted that view.

Bannon was notorious for maintaining his own, shadowy presence within the White House. He would frequently skip meetings where policy was discussed, injecting his views into the process in other ways, according to two administration officials. He did not use a computer, preferring to have paper printed and handed to his assistant to stay outside the formal decision-making process.

Bannon favoured a culture similar to the one Trump brought with him from the business world to the White House — a flat structure with blurred lines of responsibility and competing power centres. And early on Bannon benefited from that structure, sitting at the top, free to slip unvetted materials to the President without a gatekeeper to get past.

“Theoretically, a more coherent staff should produce a more coherent policy,” said David Axelrod, who was President Barack Obama’s senior adviser and the person in a comparable role to Bannon’s in the White House. “But that presupposes a President who embraces the process and the policy.”

With little process to speak of, tensions over policy swelled. Ideological differences devolved into caustic personality clashes. Perhaps nowhere was the mutual disgust thicker than between Bannon and Trump’s daughter and son-in-law.

Bannon openly complained to White House colleagues that he resented how Ivanka Trump would try to undo some of the major policy initiatives he and Donald Trump agreed were important to the President’s economic nationalist agenda, like withdrawing from the Paris climate accords. In this sense, he was relieved when Kelly took over and put in place a structure that kept other aides from freelancing.

“Those days are over when Ivanka can run in and lay her head on the desk and cry,” he told multiple people.

Ivanka Trump and Kushner, who had helped oust Kelly’s predecessor, whom they saw as ineffective, also told people they wanted a new system for the same reason.

Bannon made little secret of the fact that he believed “Javanka,” as he referred to the couple behind their backs, had naive political instincts and were going to alienate Trump’s core coalition of white working-class voters.

He told White House colleagues including the President that too many conservative Republicans in Congress would baulk if Trump took their advice and showed more flexibility on immigration, particularly toward young undocumented immigrants brought to the United States as children.

He also advised that ideological softening would buy the President no good will from Democrats or independent voters, whom Kushner and Ivanka Trump believe Donald Trump still has a chance of reaching.

“They hate the very mention of his name,” Bannon told them. “There is no constituency for this.”

His advice for the President: “You’ve got the base. And you grow the base by getting” things done.

Bannon’s disdain for General McMaster also accelerated his demise. The war veteran has never quite clicked with the President, but other West Wing staff members recoiled at a series of smears against McMaster by internet allies of Bannon. The strategist denied involvement, but he also did not speak out against them.

By the time Charlottesville erupted, Kushner and Ivanka Trump had a powerful ally in Kelly, who shared their belief that Donald Trump’s first statement blaming “many sides” for the deadly violence needed to be amended.

Bannon vigorously objected. He told Kelly that if Trump delivered a second, more contrite statement it would do him no good, with either the public or the Washington press corps, which he denigrated as a “Pretorian guard” protecting the Democrats’ consensus that Trump is a race-baiting demagogue. Trump could grovel, beg for forgiveness, even get down on his knees; it would never work, Bannon maintained.

“They’re going to say two things: It’s too late and it’s not enough,” Bannon told Kelly.

In truth, long before Charlottesville, Trump had begun losing patience. The arrival of Kelly to play precisely the gatekeeping role that would stymie aides like Bannon marked the beginning of the end.

The President believed that Bannon had been leaking unauthorised stories about infighting inside administration for months before he ultimately took action.

Trump was irritated by a book, Devil’s Bargain, that portrayed Bannon as a brilliant political Svengali but put Trump in a supporting role.

When one Trump ally noted to him recently that Bannon did help him at the end of the race, Trump interrupted, “You know, he came very late.”

The week of 7 August, Bannon suggested timing the departure to 14 August, which was a day after his first anniversary working for Trump on the campaign. It made sense to everyone.

Bannon’s physical appearance was crumbling, and his mood swings had become pronounced.

In late July, after a weekend with Robert Mercer, the hedge fund billionaire who finances some of his projects, Bannon told him, “I dread going back” to the White House.

Violence on the streets of Charlottesville Show all 9 1 /9 Violence on the streets of Charlottesville Violence on the streets of Charlottesville Protesters clash and several are injured White nationalist demonstrators clash with counter demonstrators at the entrance to Lee Park in Charlottesville, Virginia. A state of emergency is declared, August 12 2017 Violence on the streets of Charlottesville Trump supporters at the protest A white nationalist demonstrator walks into Lee Park in Charlottesville, Va., Saturday, Aug. 12, 2017. Hundreds of people chanted, threw punches, hurled water bottles and unleashed chemical sprays on each other Saturday after violence erupted at a white nationalist rally in Virginia. AP Photo Violence on the streets of Charlottesville State police stand ready in riot gear Virginia State Police cordon off an area around the site where a car ran into a group of protesters after a white nationalist rally in Charlottesville, Virginia AP Photo Violence on the streets of Charlottesville Militia armed with assault rifles White nationalists, neo-Nazis and members of the 'alt-right' with body armor and combat weapons evacuate comrades who were pepper sprayed after the 'Unite the Right' rally was declared a unlawful gathering by Virginia State Police. Militia members marched through the city earlier in the day, armed with assault rifles. Getty Images Violence on the streets of Charlottesville Statue of Confederate General Robert E Lee The statue of Confederate General Robert E. Lee stands behind a crowd of hundreds of white nationalists, neo-Nazis and members of the 'alt-right' during the 'Unite the Right' rally 12 August 2017 in Charlottesville, Virginia. They are protesting the removal of the statue from Emancipation Park in the city. Getty Images Violence on the streets of Charlottesville Racial tensions sparked the violence White nationalists, neo-Nazis and members of the 'alt-right' exchange insults with counter-protesters as they attempt to guard the entrance to Lee Park during the 'Unite the Right' rally Getty Violence on the streets of Charlottesville A car plows through protesters A vehicle drives into a group of protesters demonstrating against a white nationalist rally in Charlottesville, Virginia. The incident resulted in multiple injuries, some life-threatening, and one death. AP Photo Violence on the streets of Charlottesville Rescue personnel help injured people after a car ran into a large group of protesters after an white nationalist rally in Charlottesville, Virginia AP Photo Violence on the streets of Charlottesville President Donald Trump speaks about the ongoing situation in Charlottesville, Virginia from his golf club in Bedminster, New Jersey. He spoke about "loyalty" and "healing wounds" left by decades of racism.

After Charlottesville, Bannon maintained that a 14 August exit would look like part of the President’s response to the violence. He did not want that, and others were understanding. So they discussed moving the date to around Labour Day weekend, although two administration officials said Bannon sought to entirely renegotiate the terms of his departure.

Then came Bannon’s unguarded comments to The American Prospect, published Wednesday evening. He denigrated some colleagues, specifically identified one that he was going to see fired and said of striking North Korea, “There’s no military solution here, they got us” — a direct contradiction to the message Trump had been sending. Bannon could buy no more time.