Secretary of Defense James Mattis to leave post by start of new year, earlier than expected, Trump announces

The president also named Patrick Shanahan as acting Secretary of Defense.

Defense Secretary Jim Mattis will leave the Trump administration at the beginning of the new year, President Trump announced Sunday, nearly two months earlier than Mattis said he would depart in his resignation letter submitted to the president last week following Trump's sudden decision to remove U.S. troops from Syria.

Trump was unhappy with Mattis' resignation but grew increasingly angry over the last few days following the negative media coverage stemming from the defense secretary's criticism of the president, a White House official said. Some of his closest allies validated the critiques, further enraging the president, the official told ABC News.

"He got more and more annoyed over time," the official said.

Trump was also feeling pressure from his family and other confidantes, who pressured him to cut Mattis loose earlier, an outside advisor to the president told ABC News.

"How can you let him stay when he's been so disrespectful to you?" they asked Trump, according to the advisor.

That, combined with what sources describe as a frayed relationship with Mattis, led to Sunday's tweet and the earlier end date for Mattis' departure, the White House official and outside advisor told ABC News.

In his announcement on Twitter Sunday morning, the president also named Patrick Shanahan as acting Secretary of Defense, who is currently the deputy at the department.

"I am pleased to announce that our very talented Deputy Secretary of Defense, Patrick Shanahan, will assume the title of Acting Secretary of Defense starting January 1, 2019," Trump tweeted. "Patrick has a long list of accomplishments while serving as Deputy, & previously Boeing. He will be great!"

Shanahan, a former senior vice president of Boeing, has been focused on the Department of Defense's budget and the Space Force during his time as deputy.

Col. Rob Manning, the head of Defense Press Operations, said the "secretary of defense serves at the pleasure of the president."

"The department remains focused on national security,” he said.

The announcement comes just a few days after Mattis' abrupt resignation. In his letter to the president announcing his resignation, Mattis said he would be on until the end of February.

He had intended to testify on Capitol Hill and attend a NATO defense ministerial.

"The end date for my tenure is February 28, 2019, a date that should allow sufficient time for a successor to be nominated and confirmed as well as to make sure the Department’s interests are properly articulated and protected at upcoming events to include Congressional posture hearings and the NATO Defense Ministerial meeting in February," Mattis wrote.

Sen. Lindsey Graham of South Carolina thanked Mattis on Twitter for a "lifetime of exceptional and dedicated service to our nation."

"I know he will continue to contribute to our national security for many years to come," he wrote.