On Friday, ending weeks of speculation, chief of staff John Kelly fired the president’s chief strategist — the rumpled, populist firebrand who helped the unlikeliest candidate storm his way to the presidency. Bannon, who proved a perfect partner for Donald Trump during the campaign, struggled from the beginning to function within the confines of the West Wing.

“White House Chief of Staff John Kelly and Steve Bannon have mutually agreed today would be Steve’s last day,” press secretary Sarah Huckabee Sanders said in a statement. “We are grateful for his service and wish him the best.”

Trump, however, was notably silent on the matter. Hours after Sanders announced the news, he had still not tweeted about his onetime top strategist who had helped him secure the White House.

Over the past two weeks, Bannon has been noticeably absent from Bedminster, New Jersey, where Trump has been stationed on a working vacation. And even as he was assuring allies that his position was safe, they did not share his confidence as they watched him become siloed off in Washington, D.C., out of the information loop. Rumors of his impending fall bubbled for days.

Earlier this week, Trump made no secret of the fact that Bannon’s future was in question. And allies who have spoken to Trump in recent days said the president was fuming about the credit Bannon received in a new book — “The Devil’s Bargain,” by Joshua Green — for winning the 2016 campaign.

“Mr. Bannon came on very late,” the president told reporters at a news conference Tuesday in the lobby of Trump Tower. “You know that. I went through 17 senators, governors and I won all the primaries. Mr. Bannon came on very much later than that, and I like him.”

When asked whether he still had confidence in his chief strategist, he added: “We’ll see what happens with Mr. Bannon.”

Still, Bannon appeared to be in denial about his ouster. Although a senior administration official said Bannon submitted his resignation on Aug. 7, the strategist was still shrugging off stories of his looming ouster over the past 10 days, calling them “bullshit,” according to people who have spoken to Bannon.

But he immediately found a landing spot. Breitbart News announced Friday night that — and that he had already helmed that evening’s editorial meeting.

“The populist-nationalist movement got a lot stronger today,” said Breitbart News Editor-in-Chief Alex Marlow. “Breitbart gained an executive chairman with his finger on the pulse of the Trump agenda.”

The firing of Bannon marked the latest high-level staff shake-up in a West Wing that has been hemorrhaging senior staff at an unprecedented rate in recent months — the chief of staff, press secretary, three communications directors, the national security adviser and deputy chief of staff have all left or been fired since February.

Bannon, the bomb-thrower who took his anti-globalist worldview from fringe documentaries to Breitbart News and finally to the White House, outlasted former RNC chairman and chief of staff Reince Priebus. But he made it less than a month in the new order instilled under Kelly.

Kelly didn’t understand what Bannon did, why he had a PR portfolio, why he seemed to cause so much trouble with colleagues and why he was so widely disliked. He asked many questions about Bannon in his early days at the White House and found widespread disdain.

“No one liked him,” one senior White House official said. “People didn’t know what he did other than stab his colleagues in the back.”

Speaking on Bannon’s position in the Kelly era earlier this week, Trump ally and former House Speaker Newt Gingrich said in an interview: “I think that depends on how well Mr. Bannon learns how to salute.”

Bannon, over the past few days, has appeared to settle into his temporary office in the Eisenhower Executive Office Building, where senior staff had moved during summer White House renovations. There, he had a large office decorated with pictures, a change in scenery and tone from his cramped West Wing “war room.” Visitors said he seemed to have all the time in the world for meetings.

He has told colleagues he is looking forward to not having to wear a blazer and long pants and said he may return to Breitbart, where he can now cause considerable problems for the president and his agenda.

Bannon’s ouster was long in the making — even before Kelly’s arrival. He clashed early with Trump’s son-in-law and senior adviser Jared Kushner, and failed to cultivate allies in the West Wing. But despite his differences from Kushner — one a soft-spoken advocate of private-sector innovation, the other a provocateur populist who wants to disrupt the system — Bannon managed to soldier on.

In recent days, following Trump’s defense of white nationalists at a violent rally in Charlottesville, Democrats have been amping up the pressure to fire Bannon, who has cheered on the president’s response, publicly and privately.

“If the president is sincere about rejecting white supremacists, he should remove all doubt by firing Steve Bannon and the other alt-right white supremacist sympathizers in the White House,” House Democratic Leader Nancy Pelosi said in a statement, calling him a “shameless enforcer of those un-American beliefs.”

It wasn’t just Pelosi: Even Trump loyalists who share Bannon’s nationalist agenda turned on him.

“He was unwilling to spend his capital,” said Roger Stone, a former Trump campaign adviser who is still close with the administration. “He was unwilling to understand personnel is policy; he didn’t help anybody who was for Donald Trump get into this administration. Now suddenly he’s all by himself with no allies. He did no lifting at all.”

Even before Charlottesville, Bannon had found himself in a perilous spot after waging a not-so-subtle war on national security adviser H.R. McMaster through right-wing media outlets. Breitbart, Bannon’s former home, ran a series of smear pieces targeting the decorated general, painting him as a moderate seeking to restrain Trump and a creature of the “deep state.”

The tension was underscored by McMaster in a television appearance last weekend, when he declined to say whether he could continue to work with Bannon.

Bannon’s friends and foes alike wondered at the play — Bannon denied planting the stories himself, but his allies noted that he clearly made no attempts to stop Breitbart from publishing them.

But for Bannon, his strained relationships in the West Wing were a point of pride. He delighted in being a foil to top economic adviser Gary Cohn, who he called “globalist Gary.” Along with Cohn, Bannon saw McMaster as a threat to Trump’s presidency, and he was not afraid to say it.

That he held a dark view of his colleagues was widely known.

Bannon, who has never been known as a team player, always knew his period of influence was limited, telling friends that he had a defined window in the White House during which he could push through his agenda. That included an early flurry of activity in the form of executive orders in the opening days of the Trump administration.

He tried to push through the immigration ban targeting Muslims that Trump promised during the campaign — one that now awaits a hearing before the Supreme Court. He also procured, and was quickly stripped of, a seat on the National Security Council’s principals committee, an unprecedented role for a political strategist.

Bannon urged a dovish worldview — warning Trump against foreign entanglements — and was happy to engage in cultural wars that were widely derided in the news media. He was seen grinning in the White House after widespread protests gripped the nation following the implementation of the travel ban.

He often told Trump that at least 40 percent of the public supported him at all times and he would be foolish to govern away from his political base because “the rest are always going to hate you,” one Bannon ally said.

Bannon also took considerable pride in checking off agenda items on his large whiteboard in his “war room” and joked that while others said his power was diminishing: “I’m still winning.”

Reaction to his dismissal underscored the belief that Bannon had been a destabilizing force in a West Wing that has careened from one crisis to the next.

“He was a disruptive force and wouldn’t follow process. It will now be easier for the chief of staff and staff secretary and policy councils to institute more structure to the policy-making process,” said one White House official.

Moving forward, the official added, West Wing watchers should expect to see a more rigorous structure for decision-making and process implementation across all areas including taxes, trade, and health care — not to mention greater care in making sure that policies are enforced.

Others, however, worried that Bannon’s departure would leave a White House with no high-ranking Republicans in the West Wing — and no coherent ideology to define Trumpism.

Some in the White House expressed concern that Bannon’s firing would further empower more centrist figures like Cohn, Kushner and Ivanka Trump. Bannon may have been endlessly controversial but, one of these people argued, at least he was not a Democrat.

“Bannon’s departure would seem to leave Trump unmoored and signal his complete break from the populist ‘America First’ doctrine that helped him peel away economic-focused voters,” said Brian Fallon, who served as Hillary Clinton’s press secretary during the 2016 campaign.

That view of Bannon — as a central, pivotal figure for Trump — was part of his undoing.

Trump chafed at the image of Bannon as puppeteer, as portrayed on magazine covers and “Saturday Night Live,” where Bannon was the grim reaper behind the Resolute desk, leaving Trump relegated to a tiny desk beside him, playing with an expandable plastic ball. The image was not entirely fair. Bannon’s influence was real, but not commanding. He did notch real policy wins, like the American withdrawal from the Paris climate deal, but that was hardly a change of course for Trump. And the same culture wars that Bannon so delights in have long been just as natural for Trump.

Bannon’s rise in Trump’s orbit took place rapidly. He came on board a struggling campaign in August 2016, taking a leave from his post at Breitbart. As the campaign’s CEO, Bannon quickly became a background player, rarely seen or heard. But he began engineering the removal of the restraints that campaign chairman Paul Manafort had tried to impose on the contrarian former reality-show star.

Some of Trump’s advisers saw the path to victory in curtailing Trump’s natural tendencies; Bannon saw a path in amplifying them.

He was happy to counter first lady Michelle Obama’s rallying cry, “When they go low, we go high,” with going lower.

And for Trump, Bannon brought an intellectual framework and philosophy to Trump’s disparate policy views.

Bannon’s abrasive, take-no-prisoners style was perfect for a campaign that fought from the gutter. He was photographed grinning mischievously from the back of the room when he brought four women who had accused Bill Clinton of sexual assault to conduct a news conference ahead of a presidential debate.

At the time of his hiring, overconfident Democrats tried to cast the entry of Breitbart into the Republican mainstream as a sign that Trump was no longer running to win.

Clinton’s campaign manager, Robby Mook, blasted Trump for turning “his campaign over to someone who’s best known for running a so-called news site that peddles divisive, at times racist, anti-Muslim, anti-Semitic conspiracy theories.” Democrats viewed Bannon’s hire as the desperation move of a candidate who no longer saw a path to victory, made simply to play to a base he could monetize after Clinton won the presidency.

They were all wrong.

Inside the White House, however, that street-fighting style proved an impediment to the work of governing — especially under Kelly’s more procedural approach.

“I’m not doing this to have friends,” Bannon told New York Magazine earlier this year. He compared his White House job to a tour of duty in the Navy. “This is not living,” he said. “This is a kind of existence.”

Despite that attention, Bannon rarely spoke publicly and had been known to spend 16-hour days in the White House.

That changed in his final days on the job in the White House, when Bannon conducted a slew of on-the-record interviews as rumors swirled about his impending ouster. In an interview with the progressive magazine The American Prospect, he undercut Trump’s position on North Korea, saying there was no “military solution.” In a follow-up with The New York Times, he cheered on the racially charged debate over the removal of Confederate statues, saying it would help Trump politically.

When the ax finally fell, Bannon, colleagues said, was the last one to accept it. Even after clashing directly with Kelly, one White House official said, “He’s been in denial.”