President Trump is replacing embattled White House Chief of Staff Reince Priebus with John Kelly, his Homeland Security secretary, capping a tumultuous six months marked by staff in-fighting and political reversals.

Announcing the switch late Friday via Twitter, Trump called retired Marine Corps general Kelly a "great American" who has "done a spectacular job at Homeland Security" and "been a true star of my administration."

In a separate tweet, Trump thanked Priebus "for his service and dedication to his country" and did not mention the tensions that marked their relationship.

Priebus was a frequent target of criticism from Trump loyalists who said he failed to help the president win congressional legislation, such as the effort to repeal and replace Obamacare which remains stalled.

The new chief of staff, Kelly, will start Monday, White House spokesperson Sarah Sanders said, adding that "the entire administration loves him and no one is comparable."

Trump has repeatedly praised Kelly for his operation of homeland security, including tighter border controls and a travel ban from six Muslim countries that is currently the subject of a lawsuit.

Yet Kelly broke with Trump last week, when he, along with several top national security officials, publicly affirmed the U.S. intelligence community's conclusion that Russia interfered in the 2016 election at the Aspen Security Conference.

Trump has refused to back the assessment and has denounced the ongoing investigations into Russia's election year meddling and possible collusion with his campaign as a "witch hunt."

Kelly, who said in a statement that he is honored to serve in the White House, is one of several generals who is a part of Trump's inner circle. In addition to Defense Secretary Jim Mattis, who is a retired general, former military man H.R. McMaster serves as Trump's national security adviser.

Related:

New White House chief of staff John Kelly recently broke with Trump on Russia election hacking

5 things to know about new White House chief of staff John Kelly

In a written statement, Priebus thanked Trump for providing him with "this very special opportunity" and that he "can't think of a better person that Gen. John Kelly to succeed me."

"It has been one of the greatest honors of my life to serve this president and our country," he said. "I will continue to serve as a strong supporter of the President's agenda and policies."

Priebus's dismissal comes a week after Trump hired Wall Street businessman Anthony Scaramucci, a move that sparked a long-rumored shake-up among the president's top aides.

Scaramucci accused Priebus of being behind the leaking of unflattering news stores, a cardinal sin in Trump's eyes. Priebus had tried unsuccessfully to block Scaramucci's hiring.

Rick Tyler, a Republican political analyst, said Priebus has been "isolated" for so long, "he effectively was gone a while ago."

Now, Tyler said, "Kelly has the massive task of getting a dysfunctional White House to function — but for that to happen he has to get an out-of-control president under control. I don't give him much chance of success, but as Trump likes to say, 'Time will tell.' "

A senior administration official, speaking under condition of anonymity, declined to say whether Priebus was fired or resigned, but did say that Trump told him two weeks ago he would be replaced.

Priebus leaves as the shortest-serving chief of staff at the outset of an administration; James Baker served as chief of staff for the last five months of the George H.W. Bush administration as he was defeated for re-election.

From the moment Trump became president on Jan. 20, Priebus was the source of near-constant speculation about how long he would last in a White House riven by warring factions.

There has been long-standing staff rivalry between veterans who signed up early for Trump's presidential campaign and Republican National Committee officials brought in for the fall race against Democratic nominee Hillary Clinton.

That tension came to a head when Priebus, the former RNC chairman, objected to the hiring of Scaramucci to be the White House's communications director last week.

The appointment of Scaramucci, a prominent television surrogate for Trump during the campaign, prompted the immediate resignation of White House press secretary Sean Spicer on July 21.

Priebus brought with Spicer, a former RNC official, with him to the White House.

Priebus and other officials thought Scaramucci was unqualified for the job and had blocked him from previous efforts to join the White House.

Yet Priebus was overruled, and Scaramucci was not only hired, but allowed to report directly to Trump — not the White House chief of staff. The days after Scaramucci's hiring also brought the departure of another Priebus ally and former RNC official, senior assistant press secretary Michael Short.

Within a week of his hiring, Scaramucci publicly questioned Priebus and his loyalty to the president, giving aggressive media interviews that appeared to finger the chief of staff as a leaker.

Describing what he called a war on news leaks from senior White House officials, Scaramucci on July 27 cited Priebus in connection with leaks of news stories damaging the president and his aides.

Scaramucci in subsequent television interviews said he wasn't sure whether his spat with Priebus over leaks "is reparable or not, that will be up to the president."

He also compared his relationship with Priebus to biblical brothers Cain and Abel, though he did not specify which of them in his Biblical metaphor represented the brother who killed the other.

That same day, the feud escalated when The New Yorker revealed Scaramucci had in a phone interview attacked Priebus in harsh and even vile terms, calling him a "paranoid schizophrenic" and using a vulgar term to illustrate Priebus's attempts to block him from a White House post.

Related:

Scaramucci calls Priebus 'paranoid schizophrenic' in expletive-filled rant to reporter

Trump's newest hire, Anthony Scaramucci, takes on Chief of Staff Reince Priebus

Sean Spicer quits as White House press secretary

But Scaramucci's arrival was not the first sign of trouble for Priebus.

In his election night victory speech, Trump praised Priebus as a “superstar." But less than two months into the administration, the shine was wearing off.

In early February, tensions were already apparent: a friend of Trump's publicly argued that Priebus should be removed. Roger Stone told The Washington Post that Priebus was in "way over his head" and that other Trump loyalists questioned his allegiance to Trump.

Trump, who reportedly liked to call Priebus “Reince-y" as a nickname, apparently continued to remind Priebus that he’d urged Trump to end his campaign after the Access Hollywood tapes become public.

Priebus had been critical of Trump at times during the GOP primary campaign but urged Republicans to get behind Trump once he secured the nomination.

Still, once he was in the White House, he was viewed as more loyal to the party establishment than to Trump. The president reportedly blamed Priebus for much of the extensive leaking among White House aides.

Before joining Trump's White House, Priebus was the longest-serving chairman of the RNC — and a fundraising workhorse.

Republican insiders credited the low-key lawyer with digging the RNC out of the more than $20 million in debt after taking over the committee in 2011. He also built a robust data and voter-turnout operation that helped deliver the White House and retain the GOP majority in Congress.

Priebus had chaired Wisconsin’s GOP from 2007 to 2011, becoming the youngest person to hold that job after climbing the ladder from GOP chairman of Kenosha County to party leader for Wisconsin’s 1st Congressional District. He served on his first campaign at age 16 and was president of the College Republicans at the University of Wisconsin-Whitewater.

Meanwhile, John Kelly last week said he had no relationship with Trump before he was called by Priebus 10 days after the election to gauge his interest in the homeland job.

“I literally did not know Mr. Trump at all, and I didn't know anyone that knew Mr. Trump,’’ Kelly said at the Aspen Security Forum. “I was watching college football with my wife on a Saturday afternoon. I got a call [from] Reince Priebus, and I barely remember that.’’

Kelly said he initially thought that one of his friends was playing phone prank on him, until Priebus convinced him the call was real.

“Mr. Trump would like to have an opportunity to talk to you maybe about going into the administration,’’ Kelly said, recounting the brief conversation.

About 10 days later, Kelly was sitting with president-elect Trump.

"I’d like you take the hardest…what I consider to be the toughest job in the federal government,’’ Trump told Kelly.

“I panicked for a bit, I thought he was going to offer me the State Department,’’ the secretary said. “All I could think about is how do I get out of this, and [then] he said, ‘Homeland Security.’"

Contributing: Kevin Johnson

Related:

WH Remains Mum During Rising Staff Tensions

Reince Priebus thanks President Trump for 'blessing' of working at White House