White House Press Secretary Sean Spicer has resigned.

The resignation came less than two hours after President Donald Trump offered Anthony Scaramucci the job of communications director, according to the New York Times and the Associated Press — a decision Spicer strongly opposed. It also came exactly six months after his first statement from the podium, a special Jan. 21 briefing in which he admonished the press for the way it described Inauguration Day crowds and for reporting that a Martin Luther King, Jr. bust had been removed from the Oval Office, a story that turned out later to be untrue.

.@PressSec resigned after vehemently objecting to appointment at 10 a.m. Friday of Anthony Scaramucci as WH Communications director, per SAO — Glenn Thrush (@GlennThrush) July 21, 2017

Spicer did not respond to NewsHour’s request for comment. He said in a tweet he would serve in his role through August.

It's been an honor & a privilege to serve @POTUS @realDonaldTrump & this amazing country. I will continue my service through August — Sarah Sanders (@PressSec) July 21, 2017

In a news briefing, Deputy Press Secretary Sarah Huckabee Sanders read a statement from President Donald Trump that thanked Spicer for his service and wished him continued success.

“Just look at his great television ratings,” the statement said.

Spicer told the Washington Post that his time as press secretary has “been an unbelievable honor and privilege,” Spicer said. “This is something you dream of. I can’t thank the president enough.”

I asked Spicer if he had any regrets. "None," he said. — Ben Terris (@bterris) July 21, 2017

“We’re at the point where” the president “could benefit from a clean slate,” Spicer told the AP.

Spicer had a “tense and fraught relationship” with Scaramucci, a wealthy financier, the Washington Post reports. White House chief of staff Reince Priebus also objected to Scaramucci’s new position, the Post reports, and had blocked him from a number of other White House roles.

Scaramucci, in his first statement as communications director, called Spicer “a true American patriot.” But he said he believes there’s a disconnect between how his staff and the media see and understand the president.

“We are committed as true professionals to … getting the administration’s message out,” he said. “I think that’s going to be one of the big goals for us.”

He also said Sanders would become press secretary.

WATCH: Sarah Huckabee Sanders named White House press secretary

Trump has been frustrated by low approval ratings — which reached a new low in the second quarter, Gallup reported Friday — and the ongoing investigations into Russia’s role in the 2016 elections and possible ties to his campaign, which he has called a “witch hunt,” most recently after reports last week of an undisclosed meeting between his son Donald Trump Jr. and a Russian lawyer during the 2016 campaign.

My son Donald did a good job last night. He was open, transparent and innocent. This is the greatest Witch Hunt in political history. Sad! — Donald J. Trump (@realDonaldTrump) July 12, 2017

After White House communications director Mike Dubke resigned in May, Spicer had been balancing both Dubke’s role and his own.

Spicer began to move away from serving as the president’s daily spokesperson in June. Questions about Spicer’s place in the White House have emerged in recent weeks, as Deputy White House Press Secretary Sarah Huckabee Sanders began to take over more duties and daily briefings.

Strange times — I just went to ask @PressSec (@seanspicer) a question about @Scaramucci. He slammed the door in my face. — Jonathan Karl (@jonkarl) July 21, 2017

Fox reported on Wednesday that Spicer’s role in the White House could change, to something described as a “promotion” “overseeing the entire communications.”

Spicer’s last time at the podium was July 17.

Sean Spicer's final words from the briefing room podium as White House press secretary –> pic.twitter.com/0PHCEwnt4v — Ryan Struyk (@ryanstruyk) July 21, 2017

Before joining Trump’s staff, Spicer was the longtime communications director for the Republican National Committee.

“Every day I want to put points on the board,” he told the Washington Post shortly after joining Trump’s campaign. “That’s what I care about more than anything else.”