If loyalty is indeed what Mr. Trump wants, he says he gets it in Mr. Kelly as Priebus exits.

Retired Marine Gen. John Kelly may need to find and strap on some armour.

The battle-hardened, outspoken commander’s new mission is to steady the roiling Trump administration and quiet the friendly fire as White House chief of staff.

“He has been a true star of my administration,” the President tweeted on Friday, announcing that his current secretary of homeland security was in, and White House chief of staff Reince Priebus was out. Mr. Trump called Mr. Kelly a “great leader” and “great American.” He called Mr. Priebus a “good man.”

If loyalty is indeed what Mr. Trump wants, he gets it in Mr. Kelly. He also gets a veteran of three tours in Iraq and a survivor of a family tragedy.

As Homeland Security secretary, Mr. Kelly has taken the lead on some of Mr. Trump’s most controversial policies, including his executive orders suspending the admission of refugees and temporarily barring visitors from several Muslim-majority nations. Those orders have been stripped down by courts pending a Supreme Court review this fall.

People who know Mr. Kelly told The Associated Press that he was not aware of the details of the initial orders until around the time that Mr. Trump signed it. Yet, just days after taking office, he had to lead the agency as it dealt with the chaos and confusion that ensued at airports in the U.S. and around the world. He defended the orders to reporters and lawmakers and insisted he indeed had been part of the decision-making process.

Since joining the Marine Corps in 1970, Mr. Kelly carved out a reputation as a highly respected, but often outspoken commander who could roil debate and issue unpopular directives on issues ranging from women in combat to the treatment of detainees at the Guantanamo Bay detention center.

But the man chosen by Mr. Trump to lead his sniping administration holds a more somber distinction. Mr. Kelly is the highest-ranking officer to lose a child in combat in Iraq or Afghanistan. Mr. Kelly’s son, Marine 1st Lt. Robert Kelly, was killed in November 2010 in Afghanistan.

That status, as part of what the military calls a Gold Star family, puts him in the administration of a presidential candidate who verbally attacked a Gold Star family- the Khans, Muslim-American immigrants who lost a son in Iraq and had criticised Mr. Trump at the Democratic National Convention.

Mr. Kelly retired this year, wrapping up a three-year post as head of U.S. Southern Command, which spanned some of the more fractious debate over the Obama administration’s ultimately failed attempt to close Guantanamo.

Mr. Kelly was the fifth person to lead the Department of Homeland Security, which includes agencies that protect the President, respond to disasters, enforce immigration laws, protect the nation’s coastlines and secure air travel. His selection as secretary of the agency bolstered concerns about an increase in military influence in a Trump White House.

In his final Pentagon news conference, Mr. Kelly spoke about the loss of his son a topic he didn’t often discuss publicly.

“To lose a child is I can’t imagine anything worse than that. I used to think, when I’d go to all of my trips up to Bethesda, Walter Reed, I’ll go to the funerals with the secretaries of defense, that I could somehow imagine what it would be like,” Mr. Kelly said.

But, he added, “when you lose one in combat, there’s a in my opinion there’s a pride that goes with it, that he didn’t have to be there doing what he was doing. He wanted to be there. He volunteered.”

Mr. Kelly said he gets “occasional letters from Gold Star families who are asking, ‘Was it worth it?’ And I always go back with this- It doesn’t matter. That’s not our question to ask as parents. That young person thought it was worth it, and that’s the only opinion that counts.”