President Donald Trump announced in a Sunday tweet that Defense Secretary James Mattis will leave his position on Jan. 1, two months earlier than Mattis's announced departure date in his resignation letter last week. The letter was sharply critical of Trump, which may have led to his expedited exit.

Trump said Deputy Defense Secretary Patrick Shanahan, a former Boeing executive, will take over as acting Defense Secretary.

"Patrick has a long list of accomplishments while serving as Deputy, & previously Boeing," Trump tweeted. "He will be great!"

The New York Times reported Sunday that Trump, angry with coverage of Mattis' resignation, sought to expedite his departure. Mattis resigned after Trump appeared to unilaterally move to withdraw 2,000 U.S. troops from Syria against the advice of the Pentagon. Soon after Trump announced plans to remove troops from Syria, the president ordered the withdrawal of 7,000 troops from Afghanistan.

Trump administration aides told The Times that Trump became increasingly furious in the days following Mattis' strongly worded resignation letter. The Times reporting added that the president initially "did not understand just how forceful a rejection of his strategy Mr. Mattis had issued."

After initially praising Mattis in announcing his resignation last week, Trump jabbed his top military official on Saturday, tweeted that he gave the retired four-star general "a second chance" after former President Barack Obama "ingloriously fired" him. Mattis led U.S. Central Command from 2010 to 2013, but his time at the helm was cut short because of disagreements with the Obama administration on Iran.

"Some thought I shouldn’t, I thought I should," Trump wrote. "Interesting relationship — but I also gave all of the resources that he never really had. Allies are very important — but not when they take advantage of U.S."

That comment appeared to refer to one of the most-discussed lines of Mattis' resignation letter — one in which he suggested that that his views on how to treat America's allies differed from Trump's.

"My views on treating allies with respect and also being clear-eyed about both malign actors and strategic competitors are strongly held and informed by over four decades of immersion in these issues," Mattis wrote. "We must do everything possible to advance an international order that is most conducive to our security, prosperity and values, and we are strengthened in this effort by the solidarity of our alliances."

"Because you have the right to have a Secretary of Defense whose views are better aligned with yours on these and other subjects, I believe it is right for me to step down from my position," he continued, adding that his last day in office would be Feb. 28.

Many Republicans and Democrats have expressed worry about Mattis' departure. On NBC's "Meet the Press" on Sunday, Republican Sen. Pat Toomey of Pennsylvania said he was disturbed by how Mattis described Trump's worldview.

“I think Gen. Mattis has put his finger on where the president has views that are very, very distinct from the vast majority of Republicans and, probably, Democrats, elected and unelected," Toomey said. "And I think the president does not share, I would say, my view that the Pax Americana of the post-war era has been enormously good for America.”

In confirming a replacement for Mattis, Toomey said he is "going to be looking for" someone who "shares a more traditional view about America's role in the world."