WASHINGTON – Defense Secretary Jim Mattis will leave Jan. 1, rather than the previously announced resignation date of Feb. 28 because of policy disputes with President Donald Trump.

Mattis announced Thursday he was stepping down Feb. 28 because of disagreements with Trump ranging from Syria to global alliances and sparking deep anxiety among lawmakers about national security.

But Trump tweeted Sunday that Mattis would leave sooner. Trump named Patrick Shanahan, the deputy defense secretary, as acting secretary of defense.

Shanahan will be taking over as acting Defense secretary Jan. 1, Dana White, chief Pentagon spokeswoman, said Sunday.

Mick Mulvaney, acting White House chief of staff, said Sunday that relations between Trump and Mattis had been fraying and that it was the right thing for a cabinet secretary to resign if he couldn't serve the president. But Mattis' departure led to widespread criticism from Republicans and Democrats in Congress.

For his part, Trump increasingly resented the idea that Mattis was viewed as the adult in the room who had to talk to foreign officials about what U.S. policy really was, officials said. The move Sunday was an abrupt change from a conciliatory Trump tweet Saturday, which said he had given Mattis a second chance after his service in the Obama administration.

The departure comes at a tumultuous time for the administration. Besides Mattis, other cabinet departures since the midterm election in November include Trump firing Jeff Sessions as attorney general and the resignations of Interior Secretary Ryan Zinke and White House Chief of Staff John Kelly.

The announcement capped a turbulent series of events in which Trump abruptly gave notice Wednesday that 2,000 troops would be withdrawn from Syria, the prospect of a partial government shutdown drew closer and financial markets plunged.

In his resignation letter, Mattis, 68, acknowledged his differences with Trump over the need for alliances and bluntly told him that he should choose a different chief for the Defense Department.

“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 time for me to step down from my position,” Mattis wrote.

Contributing: Tom Vanden Brook.

More:With Mattis resignation, Donald Trump's bromance with military generals is over

More:Trump will continue troop withdrawal from Syria, despite military opposition, acting chief of staff says

More:White House departures: Who's been fired and who resigned