President Trump is replacing White House chief of staff Reince Priebus with his Homeland Security Secretary John Kelly.

Announcing the switch via Twitter, Trump called retired Marine Corps general Kelly a "great American."

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.

In a separate tweet, Trump said he thanked Priebus "for his service and dedication to his country."

Priebus, who flew on Air Force One with Trump during his trip to New York on Friday, did not comment when the plane returned to Joint Base Andrews.

Praising his former chief of staff, Trump said, "we accomplished a lot together and I am proud of him."

Yet Priebus's dismissal capped a tumultuous six months marked by staff turmoil and political reversals that Trump often blamed on his chief of staff.

It also 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 in Trump's eyes. Priebus had tried unsuccessfully to block Scaramucci's hiring.

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 longstanding 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 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 if 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.

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, as well as for some of the difficulty of getting health care legislation through Congress.

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, where he majored in English and political science before earning a law degree from the University of Miami.

Priebus came up short in his own bid for public office, unsuccessfully challenging a Democratic state senator in 2004.

In the 2016 election, Wisconsin voted for the Republican presidential candidate for the first time in 32 years, and his home county of Kenosha went Republican for the first time in 44 years. That was thanks in part to Priebus directing resources to the state.

The lifelong Green Bay Packers fan has two children with his wife, Sally.