President Trump has selected Gen. John F. Kelly as his chief of staff, replacing Reince Priebus in the latest major shakeup of Trump’s six-month old administration.

Trump made the announcement on Twitter, calling Kelly, currently the Secretary of Homeland Security, “a great American and a great leader.” Trump was on Air Force One at the time, returning from a speech in New York.

“John has also done a spectacular job at Homeland Security. He has been a true star of my Administration,” Trump wrote.

There had been widespread speculation that Priebus was on his way out, after the departure of Sean Spicer as press secretary last week. Spicer was spokesman for the Republican National Committee when Priebus served as chairman.

Trump also tweeted about Priebus, “I would like to thank Reince Priebus for his service and dedication to his country. We accomplished a lot together and I am proud of him!”

I would like to thank Reince Priebus for his service and dedication to his country. We accomplished a lot together and I am proud of him! — Donald J. Trump (@realDonaldTrump) July 28, 2017

Priebus was traveling with Trump on Friday, according to a White House pool report, but CNN reported that Priebus offered his resignation on Thursday. White House Press Secretary Sarah Huckabee Sanders told reporters that Trump’s conversations with Priebus about a shakeup started about two weeks ago. Kelly will begin his duties on Monday, she said, followed by a cabinet meeting.

“General John Kelly is one of the true stars of the Administration,” Sanders said. “He has helped seal the border and reduced illegal immigration by 70%. He is respected by everyone, especially the people at the Department of Homeland Security. The entire Administration loves him and no one is comparable.”

While Priebus’ tenure has been a D.C. guessing game, his status was in doubt ever since Trump named Anthony Scaramucci as his new communications director a week ago. Scaramucci sent out a tweet on Wednesday that appeared to link Priebus to leaks coming out of the White House. Then, on Thursday morning, Scaramucci called into CNN’s Chris Cuomo and said, “If Reince wants to explain that he’s not a leaker, let him do that.” Scaramucci said that his interview with Cuomo had Trump’s blessing.

Later in the day, the New Yorker’s Ryan Lizza published an expletive-filled interview with Scaramucci, in which he mocked Priebus and said that he “didn’t get the hint that I was reporting directly to the President.” He bashed Priebus as “paranoid schizophrenic.”

On Thursday, Kelly’s name was floated as a possible successor to Priebus, although media outlets were still caught off guard by the abrupt way that Trump announced the shakeup.

Kelly, 67, is a retired four-star Marine Corps general and was a commander in Iraq. He was confirmed as Homeland Security secretary in a vote of 88-11. His son, Robert Kelly, was killed in Afghanistan in 2010 while serving with the Marines.

Kelly’s selection comes at the end of a chaotic week that saw the collapse in the Senate of efforts to repeal and replace Obamacare; Trump’s repeated and public attacks on his attorney general, Jeff Sessions; and the president’s announcement on Twitter that transgender individuals would be banned from military service.

Priebus also is the latest high-level official to leave the White House in its early months. In addition to Spicer, there have been departures of Michael Flynn as national security adviser and Mike Dubke as communications director, while Trump fired FBI director James Comey.

House Speaker Paul Ryan issued a statement praising Priebus.

“Reince Priebus has left it all out on the field, for our party and our country. Here is a guy from Kenosha, Wisconsin who revitalized the Republican National Committee and became White House chief of staff.

“He has served the president and the American people capably and passionately. He has achieved so much, and he has done it all with class. I could not be more proud to call Reince a dear friend.”

Update: Priebus released his own statement.

“It has been one of the greatest honors of my life to serve this President and our country,” he said. “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. I can’t think of a better person than General John Kelly to succeed me and I wish him God’s blessings and great success.”

In an interview with CNN’s Wolf Blitzer, Priebus said that Trump “was right to hit the reset button.”

He declined to address Scarmucci’s comments, saying, “I am not going to get in the mud on those sorts of things.”