– President Donald Trump on Friday dismissed his embattled chief strategist, Steve Bannon, an architect of his 2016 election victory and the champion of his nationalist impulses, in a major White House shake-up that follows a week of racial unrest.

With Trump's presidency floundering and his legislative agenda in shambles, administration officials said his empowered new chief of staff, John Kelly, moved to fire Bannon in a bid to tame warring factions and bring stability to a White House at risk of caving under self-destructive tendencies.

A combative populist on trade and immigration, Bannon was arguably Trump's ideological id on the issues that propelled his candidacy. He served as a key liaison to the president's conservative base and the custodian of his campaign promises.

Bannon had been a lightning rod for controversy since joining Trump's campaign last summer, but he attracted particular scorn in recent days for encouraging and amplifying the president's divisive remarks in the wake of last weekend's deadly white supremacist demonstration in Charlottesville, Va.

Sarah Huckabee Sanders, the White House press secretary, said in a Friday afternoon statement to reporters: "White House Chief of Staff John F. Kelly and Steve Bannon have mutually agreed today would be Steve's last day. We are grateful for his service and wish him the best."

Bannon returned Friday to Breitbart News, where he worked before joining the Trump team. He told the Weekly Standard: "The Trump presidency that we fought for, and won, is over. We still have a huge movement, and we will make something of this Trump presidency. But that presidency is over. It'll be something else. And there'll be all kinds of fights, and there'll be good days and bad days, but that presidency is over."

Some White House officials also said Friday that they expect some of Bannon's allies inside the administration to exit with him. Two such people are national security aide Sebastian Gorka and presidential assistant Julia Hahn, although both have portrayed themselves as Trump allies first and Bannon allies second.

Bannon was locked in a long and tortuous battle with senior adviser Jared Kushner, Trump's son-in-law, and a coterie of like-minded senior aides, many with Wall Street ties.

Bannon had been expecting to be cut loose, people close to him said. One of them explained that Bannon was resigned to that fate and is determined to continue to advocate for Trump's agenda on the outside.

"Steve's in a good place. He doesn't care. He's going to support the president and push the agenda, whether he's on the inside or the outside," said this person, who like others spoke on the condition of anonymity.

Bannon had told associates in recent days that if he were to leave the White House, the conservative populist movement that lifted Trump in last year's campaign would be at risk. Bannon also predicted that Trump would eventually turn back to him and others who share the president's nationalist instincts, especially on trade.

Rep. Steve King, R-Iowa, who is close to Bannon, said that Trump's base could revolt. "With Steve Bannon gone, what's left of the conservative core in the West Wing? Who's going to carry out the Trump agenda?" he asked in an interview.

"This looks like a purging of conservatives," King said. "The odds of him completing his campaign promises, even to the limit of his executive authority, have been diminished."

The consequences on Capitol Hill could be wide-ranging. House and Senate Republican leadership have long been wary of Bannon, and their allies were cheering Friday at news of his departure. But among the hard right in Congress — including Rep. Mark Meadows, R-N.C., chairman of the House Freedom Caucus — there was anger and doubt that anyone left in the White House shares their appetite for political confrontation.

The decision to fire Bannon was made by Kelly, the retired four-star Marine Corps general brought in late last month as White House chief of staff, officials said. It came after exactly three weeks in a position where he was given unilateral power to overhaul the staff in an effort to stanch warring among factions, aides and advisers going rogue and repeated leaks.

This past week, as mainstream Republicans lambasted Trump for his handling of the Charlottesville violence, many on the White House staff led a drum beat for the president to dismiss Bannon and any other aides who have connections of any kind to the white nationalist movement. "The fevered pitch was basically outrage from dozens on the staff that anybody who's ever had a part of that has to be purged immediately," an official said.

Kelly has no personal animus toward Bannon, said people familiar with his thinking. But Kelly was especially frustrated with Bannon's tendency to try to influence policy and personal matters not in his portfolio, as well as a negative media campaign he and his allies waged against National Security Adviser H.R. McMaster.

A person close to Kelly said he was intent on making the White House not only less chaotic but also less driven by a particular ideology. He made clear to his deputies that he did not want to align with any faction, but rather to shake up a culture on the staff. Kelly said he wanted power to drift from Trump to him, period.

This week, at a moment when even his allies and confidants agreed that his job security was as precarious as ever, Bannon further imperiled his standing by giving an interview to the liberal American Prospect magazine, in which he sniped by name at his enemies within the White House — including Gary Cohn, the National Economic Council director — and publicly contradicted the administration's stance on North Korea.

The potential for Bannon to wreak havoc and mischief from outside the White House is among the reasons Trump had been skittish about firing him. Bannon himself has signaled that he will pursue his nationalist, populist agenda from outside the West Wing.

"I don't think Steve is going to totally abandon the president or be totally disloyal, unless the president allows himself to be overtaken by the liberal Democrats, in which case every Republican will call him to account," said one outside White House adviser.