Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

In a surprise move, President Donald Trump on Friday named U.S. Rep. Mark Meadows his new chief of staff, replacing acting chief Mick Mulvaney.

Trump also announced on Twitter that Mulvaney would become U.S. special envoy for Northern Ireland.

The president did not give a reason for why he replaced Mulvaney.

....I want to thank Acting Chief Mick Mulvaney for having served the Administration so well. He will become the United States Special Envoy for Northern Ireland. Thank you! — Donald J. Trump (@realDonaldTrump) March 7, 2020

Meadows, R-North Carolina, said Friday night that he is honored by appointment.

"It's an honor to be selected by President Trump to serve alongside him and his team," Meadows said in a statement. "This President and his administration have a long list of incredible victories they've delivered to the country during this first term, with the best yet to come — and I look forward to helping build on that success and staying in the fight for the forgotten men and women of America."

Download the NBC News app for breaking news and politics

A person familiar with the discussions said Meadows was offered the job Thursday and that Mulvaney, who has been traveling for most of the week, did not find out until Friday. Another source said that Mulvaney was given a heads-up before the president’s tweet.

Trump mused about this decision with allies before making his move: The person familiar with the discussions said that Trump had been calling around to lawmakers this week, asking how they thought Mulvaney was doing — and the response was far less positive for Mulvaney than it was for Meadows.

For the president, that apparently solidified a decision that he'd been thinking about for a while, as the rumor mill churned with speculation Mulvaney was acting on borrowed time in his role as chief of staff. “The clock was up,” one source close to the White House said.

Mulvaney technically remains the director of Office of Management and Budget, but he is expected to leave that role. A source said that Mulvaney had lobbied for his new job as envoy to Northern Ireland even before he was named acting chief of staff.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Meadows is considered one of Trump’s staunchest congressional allies. He announced in December that he would not seek re-election in 2020. At the time, Meadows suggested that he could have a role in helping the president.

The lawmaker said then that his "work with President Trump and his administration is only beginning."

Acting White House Chief of Staff Mick Mulvaney listens during a cabinet meeting held by President Donald Trump at the White House on Oct. 21, 2019. Leah Millis / Reuters file

Meadows, who is set to become the president's fourth chief of staff, in his statement called Mulvaney a friend and said "he did a great job leading the President's team through a tremendous period of accomplishment over the last year plus."

Mulvaney became chief of staff in December 2018, after the president announced that John Kelly was to leave at the end of that year.

Trump’s first chief of staff, Reince Priebus, was removed by the president in July 2017 after six months on the job.

The president on Friday night thanked Mulvaney “for having served the Administration so well."

Trump was asked in early February whether Mulvaney would stay on as chief of staff, and the president responded “That was a false report. I have a great relationship with Mick,” according to a White House transcript.

In December, Mulvaney seemed to admit that the withholding of military aid to Ukraine was tied to demands that the country investigate a conspiracy theory about the 2016 election.

"We do that all the time with foreign policy," Mulvaney said at that news conference.

"Get over it," he said. "There’s going to be political influence in foreign policy."

Mulvaney later tried to walk back the remarks. "There was absolutely no quid pro quo between Ukrainian military aid and any investigation into the 2016 election," he said.

But Mulvaney's admission angered and confused Trump allies inside and outside the administration, according to two people familiar with the matter. One of them called Mulvaney’s comments in the White House briefing room "an unmitigated disaster."

The withholding of military aid to Ukraine and alleged pressure to investigate the 2016 theory and announce investigations into Joe Biden and his son were central to the impeachment of Trump by the House. Critics accused Trump abusing the power of his presidency for personal political gain.

The articles of impeachment charged Trump with abuse of power and obstruction of Congress. The Republican-held Senate acquitted the president in February.

Meadows was a founding member of the House Freedom Caucus. Fellow leading caucus member Rep. Jim Jordan, R-Ohio, who is also a vocal defender of the president, tweeted Friday night that Trump “couldn’t have picked anyone better for the job."

Meadows has long been one of Trump’s closest confidantes. One source close to the White House suggested that the president feels Meadows is better equipped than Mulvaney to take on a surrogate role and to “focus on the things that need to be done for re-election."

Another source said that at least Mulvaney left his job "with something to show for it."

"He got the joke. He knew what the role was, what the expectations were and what the reality was. He knew this wasn't going to last forever," the source said.

Despite the shakeup, a different source pointed out that everyone knows who the real chief of staff is: Trump. “That’s not going to change,” the source said.