WASHINGTON (Reuters) - White House Press Secretary Sean Spicer resigned on Friday, ending a short and turbulent tenure that made him a household name and the butt of late-night television comedy lampoons, amid further upheaval within President Donald Trump’s inner circle. While not a surprise, Spicer’s departure was abrupt and accompanied other changes in Trump’s media and legal teams, as an investigation of possible ties between his campaign and Russian meddling in the 2016 presidential election widened. After six months in power and still without a major legislative win, Trump shuffled some of his closest staff, parting ways with Spicer after naming Anthony Scaramucci as the new White House communications director. Spicer had been communications director as well as press secretary following the resignation of Mike Dubke as director early last month. A Republican close to the White House told Reuters that Trump settled on Scaramucci, 53, a political supporter and former Goldman Sachs banker, for the head media job on Thursday and met with him on Friday morning to formally offer it to him. A White House official briefed on what happened next said Spicer was told of Scaramucci’s hiring and Trump urged Spicer to stay on. But Spicer, 45, said he did not want to stay on under the terms and conditions described to him and quit. A source close to the White House said: “Basically Donald Trump likes Scaramucci on TV and saw the communications director job as a way to ... make him a top TV surrogate.” The source said Trump wanted Spicer to be press secretary and do much of the communications director’s work as well, “with Scaramucci holding the ceremonial title with no responsibility. And that was the real challenge.” At an early afternoon briefing, Scaramucci, in his debut before the White House press corps, named Sarah Sanders as the new press secretary. She had been Spicer’s deputy. Known by insiders as “Mooch,” the new communications director is a Harvard Law School-educated Long Islander who founded a hedge fund after leaving Goldman, and sold it to join the Trump administration.  Spicer, a veteran Washington staffer, was parodied memorably by actress Melissa McCarthy on the “Saturday Night Live” TV comedy show for his combative encounters with reporters. “I am grateful for Sean’s work on behalf of my administration and the American people,” Trump said in a statement. “I wish him continued success as he moves on to pursue new opportunities. Just look at his great television ratings.” Spicer will stay on the job through August. From the start, Spicer invited controversy, attacking the media in his first appearance as press secretary for reporting what he called inaccurate crowd numbers at Trump’s Jan. 20 inauguration. “This was the largest audience to ever witness an inauguration, period, both in person and around the globe,” he said, an assertion that quickly drew scorn. In a Twitter post on Friday, Spicer wrote, “It’s been an honor & privilege to serve @POTUS @realDonaldTrump & this amazing country. I will continue my service through August.” Before Trump tapped him for the job of press secretary, Spicer was the Republican National Committee’s spokesman. He had previously worked in the administration of former President George W. Bush. During that time, he dressed up in an Easter Bunny costume for the annual White House Easter Egg Roll. Spicer and other Trump aides shook up White House dealings with the media, including cutting back daily televised news briefings and replacing them with audio briefings only. Scaramucci told reporters, “I love the president. ... It’s an honor to be here.” Asked how he was going to right the White House ship, Scaramucci said there was nothing to fix.  “The ship is going in the right direction. I like the team. Let me rephrase that: I love the team,” he said. Separately, Special Counsel Robert Mueller, who is investigating the possible Trump-Russia ties, has asked White House officials to preserve any records of a meeting last year between the president’s eldest son, Donald Trump Jr., and a Russian lawyer, a source with knowledge of the request said on Friday. The spokesman for Trump’s outside legal team, Mark Corallo, resigned. His departure came amid media reports that the role of Marc Kasowitz, who had been leading the team, was being reduced. On Thursday, Attorney General Jeff Sessions brushed off sharp criticism from Trump, saying he loved his job and planned to stay in it. Trump took a broad swipe at his administration’s top law officers this week in a New York Times interview, saying he would not have appointed Sessions as attorney general if he had known he would recuse himself. White House unrest was not limited to communications and legal staff, said two officials familiar with the situation. Trump has ignored the recommendations of national security adviser H.R. McMaster and his senior director for Russia, Fiona Hill, on dealing with Russian President Vladimir Putin, the officials said, speaking on condition of anonymity. They said McMaster is frustrated by continuing debate about sending more U.S. forces to Afghanistan. One official said tension persists between McMaster and chief White House strategist Steve Bannon and chief speechwriter Stephen Miller. 