White House press secretary Sean Spicer, President Donald Trump's embattled spokesman during the first six months of his presidency, is resigning his position, according to two people with knowledge of the decision.

Spicer's decision appears to be linked to the appointment of a new White House communications director, New York financier Anthony Scaramucci. The people with knowledge of the decision spoke on condition of anonymity because they were not authorized to discuss the personnel matter publicly.

Spicer's daily press briefings had become must-see television until recent weeks when he took on a more behind-the-scenes role. Deputy press secretary Sarah Huckabee Sanders has largely taken over the briefings, turning them into an off-camera event.

It's been an honor & a privilege to serve @POTUS@realDonaldTrump & this amazing country. I will continue my service through August

Spicer spent several years leading communications at the Republican National Committee before helping Trump's campaign in the general election. He is close to White House chief of staff Reince Priebus, the former RNC chair, and several of the lower-ranking aides in the White House communications shop.

Scaramucci is expected to play a visible role as one of Trump's defenders on television. But Spicer and other officials questioned his hiring as communications director ahead of the president's push to overhaul the tax system and other policy issues. One of the officials said Spicer objected to Trump's vision for the future of the press operation.

Spicer's tenure got off to a rocky start. On Trump's first full day in office, Spicer lambasted journalists over coverage of the crowd size at the inauguration and stormed out of the briefing room without answering questions.

His fiery demeanor and tense on-camera exchanges were mocked on Saturday Night Live, with the role of Spicer being played by actress Melissa McCarthy.