Former White House press secretary Sean Spicer walks into the West Wing on Friday after resigning from his post earlier in the day. (Jabin Botsford/The Washington Post)

Sean Spicer had not fully moved into his West Wing office in January when he interrupted an informal chat with reporters to show off a prized new possession — the ceremonial White House press secretary flak jacket passed down by his predecessors.

It was meant to symbolize the incoming blasts from reporters. But for Spicer, who announced his resignation Friday after just six tumultuous months on the job, it was the crossfire from inside the West Wing that brought him down.

To a degree unseen before at the White House lectern, Spicer, 45, became a household name, a constant target for critics and late-night comics. He was lampooned on television and social media as the chief spokesman for a White House that is frequently off message and prone to falsehoods. He gained a reputation as a pugnacious, often tongue-tied defender of a boss in President Trump who never really wanted him in the job and always thought he could do better at defending himself.

On Friday, as news broke that Trump had hired Anthony Scaramucci, a brash New York financier, as his new communications director over Spicer’s personal objections, the situation was no longer sustainable. Trump, who undercut Spicer time and again and dragged him through a series of public humiliations, had made clear he no longer had much use for him.

“Better to give them an opportunity to have a clean slate and evaluate what we’ve done — to figure out what’s working and what needs to be improved upon,” Spicer said in a brief telephone interview with The Washington Post. Ever the loyal staffer, Spicer said he would remain at the White House through August to help smooth the transition for Scaramucci and Sarah Huckabee Sanders, Spicer’s deputy who was promptly named to replace him.

(Meg Kelly,Erin Patrick O'Connor/The Washington Post)

“It’s been an unbelievable honor and privilege,” Spicer said. “This is something you dream of. I can’t thank the president enough.”

The dramatic denouement was an appropriate metaphor for a Trump White House that has been defined by backbiting and infighting. But the decline that led to Spicer’s departure has been long in the making and extraordinarily public in its nature.

The humiliations started with his first appearance at the lectern a day after Trump’s inauguration, when Spicer, in an ill-fitting light-gray suit, insisted in strident tones that reporters had sought to undermine the new president by comparing his inaugural crowd unfavorably to the historic size of President Barack Obama’s inauguration.

“That was the largest audience to witness an inauguration, period,” Spicer declared, a statement that was proved false by fact-checkers and obviously wrong to the naked eye of any impartial observer. Spicer left the room without taking questions.

It was later revealed that Trump, angered by cable news coverage of empty expanses on the Mall, had personally ordered up the performance.

“The job as White House press secretary is hard to begin with, but when you’re being undercut by your boss and his senior people are providing false information, that makes it nearly impossible to do the job,” said Jennifer Psaki, who served as White House communications director and State Department press secretary under Obama. “What I saw was somebody who clearly was put in a compromising and difficult position at the White House podium.”

Spicer was never an obvious match for a president who had no Washington political experience and reveled in a freewheeling campaign in which he dominated the airwaves with outlandish and often conflicting statements. Spicer, who was not part of Trump’s campaign, was a prototypical Beltway insider and Republican Party loyalist who had served as spokesman for the Republican National Committee when it was overseen by Reince Priebus, now the White House chief of staff.

(Bastien Inzaurralde/The Washington Post)

It was Priebus who persuaded Trump to name Spicer to the job.

“Sean kind of tried to bridge two worlds — old Washington and new Washington,” said Dana Perino, who served as President George W. Bush’s press secretary. “He did the best he could.”

Spicer made changes to the ritual of the daily briefing aimed at placating Trump, who harangued the press corps as “fake news” and reacted to news several times a day in real time on Twitter.

Spicer called more frequently on reporters from conservative news outlets. He installed monitors in the briefing room that beamed in live questions over Skype from news organizations outside the Beltway. And he held one smaller “gaggle” for reporters in his office that excluded several major news outlets, including the New York Times.

But it was his live, on-camera briefings that became appointment viewing. Spicer spoke quickly and forcefully, but he was prone to flubbing attempts to match the hyperbole and rhetorical flourishes of his boss. He was forced to apologize after he asserted that Syrian President Bashar al-Assad had crossed more red lines than Adolf Hitler because the Nazi leader had never gassed his own people.

The briefings were entertaining, if at times surreal, and the ratings reflected it. That cut both ways for Trump, a New York real estate promoter who had made a fortune in reality television. Trump appeared to offer a backhanded compliment about Spicer’s notoriety in thanking him Friday.

“I’m grateful for Sean’s work on behalf my administration and the American people,” Trump said in a statement. “I wish him success as he moves on to pursue new opportunities — just look at his great television ratings.”

Yet in recent weeks, the public perception of Spicer stumbling around the briefing room spraying water guns at reporters — as popularized by Melissa McCarthy’s portrayal of “Spicey” on “Saturday Night Live” — was no longer in step, even as satire, with his actual role at the White House. Spicer had largely disappeared from public view, relegated to a behind-the-scenes role for a White House that had lost control of the narrative amid the mounting Russia investigation.

Reports that Spicer had eluded reporters by ducking behind bushes in the West Wing driveway on the night Trump fired James B. Comey as FBI director became a meme for a spokesman who did not know how to explain what his boss was doing.

The press office had not conducted a televised briefing in more than three weeks before Friday, and Sanders had taken over at the off-camera sessions. Spicer, a devout Catholic whom Trump had denied an audience with Pope Francis on a visit to the Vatican in May, did not travel with the president on his most recent trip to Paris.

Perino said Spicer’s relatively graceful exit is likely to preserve his relationship with Trump, adding that he “has a story that’s so amazing that he’ll be able to tell it for years.”

In the briefing room, Scaramucci put it a little bit differently, bidding Spicer good luck in a way that perhaps showed why he’s better suited for Trump: “I hope he goes on to make a lot of money.”