President Trump late Friday replaced his embattled chief of staff Reince Priebus with Homeland Security Secretary John Kelly, the decorated retired general who had been leading his administration’s charge on immigration enforcement.

The seismic shake-up capped another rollercoaster week in the West Wing, rocked by the public clash between Priebus and new White House communications director Anthony Scaramucci. The latter's hiring prompted press secretary Sean Spicer to resign in protest one week ago and immediately touched off speculation that Priebus could be next.

White House sources confirmed to Fox News that Priebus, the former Republican National Committee chairman, resigned secretly on Thursday.

“It has been one of the greatest honors of my life to serve this president and our country,” Priebus said in a statement. “I want to thank the president for giving me this very special opportunity. I will continue to serve as a strong supporter of the president's agenda and policies.”

He added, “I can't think of a better person than Gen. John Kelly to succeed me and I wish him God's blessings and great success.”

Trump made the announcement publicly on Twitter late Friday afternoon.

"I am pleased to inform you that I have just named General/Secretary John F Kelly as White House Chief of Staff. He is a Great American ... and a Great Leader. John has also done a spectacular job at Homeland Security. He has been a true star of my Administration," he tweeted.

Kelly, a retired Marine general, formerly commanded the United States Southern Command.

"I have been fortunate to have served my country for more than 45 years - first as a Marine and then as the Secretary of the Department of Homeland Security," Kelly said in a statement. "I am honored to be asked to serve as the chief of staff to the President of the United States."

The selection of Kelly was greeted with praise on Capitol Hill.

“Secretary Kelly is one of the strongest and most natural leaders I’ve ever known,” said South Carolina GOP Sen. Lindsey Graham, who has sparred with the president in the past. “As a Marine Corps officer, he instilled loyalty, respect and admiration from all who served under him.”

Speaking to reporters, White House press secretary Sarah Sanders cited Kelly’s role at the Department of Homeland Security in working to reduce illegal immigration.

“He has helped seal the border and reduced illegal immigration by 70 percent,” Sanders said. “He is respected by everyone, especially the people at the Department of Homeland Security.”

Sanders said Kelly will be sworn in on Monday, when he begins his new job.

Priebus was traveling with the president on Friday. Reporters spotted Priebus getting in a car after Air Force One landed at Joint Base Andrews.

"Reince is a good man,” Trump told reporters at Andrews. “John Kelly will do a fantastic job. General Kelly has been a star, done an incredible job thus far, respected by everybody. He's a great, great American. Reince is a good man."

A day earlier, Scaramucci was quoted in a New Yorker story using profanity as he bashed Priebus and seemed to accuse him of leaking to reporters.

“Reince is a f---ing paranoid schizophrenic, a paranoiac,” Scaramucci was quoted saying.

After that story’s publication, Scaramucci didn’t deny the comments or apologize. He tweeted that he "made a mistake in trusting in a reporter.”

“I sometimes use colorful language,” he said. “I will refrain in this arena but not give up the passionate fight for @realDonaldTrump's agenda.”

In an interview with CNN’s Wolf Blitzer on Friday evening, Priebus said he had been discussing the prospect of resigning with the president “for a few days.”

“I think Gen. Kelly is a brilliant pick,” Priebus said, noting he would help Kelly with the transition for several weeks.

Priebus said he was leaving on good terms with the president.

“This is not like a situation where there’s a bunch of ill-will feelings. This is, I think, good for the president. I think it’s smart for him to pick Gen. Kelly. And I think that things are going to be run very well,” he said.

Priebus declined to discuss Scaramucci’s comments about him. “I’m not going to respond to it,” he said. “I’m not going to get into the mud on those sorts of things.”

Asked if he was a leaker, he said: “That’s ridiculous, Wolf, come on. I’m not going to get into his accusations.”

Priebus said he planned to take some vacation time with his family, but that he’d continue to support the president.

“I’m always going to be a Trump fan,” he said. “I’m on Team Trump. And I look forward to helping him achieve his goals and his agenda for the American people.”

Both Priebus and Spicer worked together at the Republican National Committee before joining the administration. Another White House press aide who worked with Priebus and Spicer at the RNC, Michael Short, who was also forced out of his job this week.

At 189 days, Priebus had the shortest tenure of any chief of staff in modern history who was not serving in an interim capacity or leaving with their president. The position was formally established in 1946.

Fox News' Alex Pappas and Serafin Gomez contributed to this report.