United States’s Secretary of Defense James Mattis resigned on Thursday a day after President Donald Trump announced the withdrawal of US troops from Syria.

Trump in a tweet said that Mattis will retire in February after having served his administration for two years. He said a new secretary of defence would be announced shortly.

“During Jim’s tenure, tremendous progress has been made, especially with respect to the purchase of new fighting equipment,” Trump said. “General Mattis was a great help to me in getting allies and other countries to pay their share of military obligations.”

Mattis in his resignation letter to Trump said he was leaving because “you have a right to have a Secretary of Defense whose views are better aligned with yours”.

Mattis said his “core belief” is that American strength is “inextricably linked” with its alliances and partnerships with other nations, a position which is at odds with Trump’s “America First”. The president has frequently criticised America’s allies in France, the United Kingdom, Canada and Germany.

Mattis said China and Russia want to spread their “authoritarian model” and promote their interests at the expense of America and its allies. “That is why we must use all the tools of American power to provide for the common defense,” he wrote in the letter.

Trump’s decision to pull out over 2,000 US troops from Syria has faced criticism over abandoning Kurdish allies who may face Turkish assault after the US leaves. Mattis said it was important for US to stand up to its allies, an apparent reference to the president’s decision on Syria.

Republican Senator Marco Rubio tweeted that the US was “headed towards a series of grave policy errors which will endanger our nation, damage our alliances [and] empower our adversaries”.

House Minority Leader Nancy Pelosi said Mattis was a comfort to those who “were concerned about the path the Trump Admin would choose to take”. “All of us should be concerned at this time.”

“This is scary,” said Senate Intelligence committee Vice Chairman Mark Warner. “Secretary Mattis has been an island of stability amidst the chaos of the Trump administration.”