President Donald Trump has replaced chief of staff Reince Priebus with Secretary of Homeland Security John Kelly, he said Friday afternoon on Twitter.

The announcement came after the failure of the Republican health care repeal bill, and as White House personnel fights exploded in dramatic fashion. Priebus had increasingly been the subject of Trump’s ire, as his agenda has been stalled on Capitol Hill.

The former Republican National Committee chairman has repeatedly clashed with new White House communications director Anthony Scaramucci, who had threatened to push Priebus out of the White House. Priebus allies in the White House have been under pressure for months, with former Press Secretary Sean Spicer resigning last week after Scaramucci’s hiring and Assistant Press Secretary Michael Short quitting after Scaramucci divulged to a reporter his intent to fire him.

A source close to Priebus told TIME that the chief of staff resigned privately Thursday. Priebus accompanied Trump on a trip to New York Friday afternoon, and Trump’s tweet was sent as the pair were on Air Force One returning to Washington. Nearly all White House staffers, including several Assistants to the President, were unaware of the news before Trump tweeted. Jared Kushner and Ivanka Trump were supportive of the move, an official said.

“Reince is a good man,” Trump told the White House traveling press corps gathered at Andrews Air Force Base outside Washington after the news broke Friday afternoon. “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.”

White House officials spent the afternoon and early evening Friday processing the news and attempting to discern who else might follow Priebus out the door. Embattled chief strategist Steve Bannon, who has also clashed with Scaramucci, Kushner, and Ivanka Trump, tried to highlight his long relationship with Kelly inside the White House Friday.

Priebus’ departure comes as Trump’s ties with his adopted party have frayed, with the defeat of the Senate healthcare bill early Friday, the ongoing Russia investigation consuming Capitol Hill, and tensions over his foreign policy agenda. Lawmakers have looked to Priebus as a source of ideological stability for the president, relying on him to pressure Trump against attacks on Republicans and to keep the president from straying too far from party orthodoxy.

The surprise appointment raised a number of questions. Not least was the challenge of finding a new chief for the Department of Homeland Security. When Kelly was confirmed, the President’s ideas about border security, the wall on the U.S.-Mexican border was a campaign promise and little more, and the ban on individuals from Muslim countries were still notions and not policy. Confirming a new Secretary for Homeland Security will be treated as a referendum on the first six months of policy coming out of the Department. The travel ban — or “Muslim ban,” as Trump called it against the advice of lawyers — could dominate the hearings. “Goodness, this could get messy,” said one senior Republican aide on Capitol Hill.

The Senate is already lagging in confirming Trump’s nominees, and the hole Kelly leaves will be tough to patch in a timely fashion. The Senate is set to leave next month for an abbreviated August recess, and it’s not likely anyone is eager to rush through a nominee to oversee the sprawling Department of Homeland Security. “He doesn’t make this easy, does he?” a second Republican aide in the Senate responded dryly by text message.

Separately, elevating Kelly, a well-respected General, to a key political post does little to calm leaders in Congress. In Priebus, they knew they had a political animal on the inside, even if he wasn’t as well-versed in the legislative process. In Kelly, they have an absolute neophyte.

But, among Republicans on the Hill, there was also some head-scratching. What, they wondered, does Kelly know about domestic policy issues like taxes and health care? How much authority would Kelly have in shaping the direction of the White House agenda, and can he get Trump to focus on a few deliverable priorities? He brings a military discipline to the office, not dissimilar to Colin Powell’s time as National Security Adviser to Ronald Reagan.

Kelly’s inexperience in his new arena, argued a third Hill staffer, could help empower people inside the White House like legislative liaisons Marc Short and Joyce Meyer to have the room to run their offices. With fights on taxes and infrastructure looming, leaving veterans of Capitol Hill offices to represent the White House could ease the process—and, in turn, increase the authority of Vice President Mike Pence, a former member of the House with close ties to the conservative base there.

Priebus was an experienced political hand, but was not viewed as a particularly strong manager. Some White House aides are hoping Kelly brings the skills needed to professionalize and streamline the West Wing. But it is not yet clear how empowered he will be in the role.

Trump has embraced a nontraditional West Wing structure. He maintains more than a dozen direct-reports, weakening the power of the chief of staff role. Priebus had struggled with the usual expectations of the job, but was never fully entrusted by the president with its powers.

It has been one of the greatest honors of my life to serve this President and our country. 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.

“It has been one of the greatest honors of my life to serve this President and our country,” Priebus said in a statement distributed by the White House. “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.”

Priebus’ departure marks a period of record personnel turnover in the White House. Since Inauguration Day, Trump has now parted with his chief of staff, deputy chief of staff, national security advisor, press secretary and communications director, among other less senior aides.

Get our Politics Newsletter. The headlines out of Washington never seem to slow. Subscribe to The D.C. Brief to make sense of what matters most. Please enter a valid email address. Sign Up Now Check the box if you do not wish to receive promotional offers via email from TIME. You can unsubscribe at any time. By signing up you are agreeing to our Terms of Use and Privacy Policy . This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply. Thank you! For your security, we've sent a confirmation email to the address you entered. Click the link to confirm your subscription and begin receiving our newsletters. If you don't get the confirmation within 10 minutes, please check your spam folder.

Write to Philip Elliott at philip.elliott@time.com.