WASHINGTON (Reuters) - U.S. President Donald Trump on Monday criticized departing Defense Secretary James Mattis and his view of alliances, saying the Pentagon chief failed to recognize the true costs of America’s military support around the world.

A day after Trump announced he would replace Mattis two months earlier than expected, the president took a parting shot at the Pentagon chief, who resigned last week over policy differences with Trump.

“We are substantially subsidizing the Militaries of many VERY rich countries all over the world, while at the same time these countries take total advantage of the U.S., and our TAXPAYERS, on Trade,” Trump wrote in a series of tweets.

“General Mattis did not see this as a problem. I DO, and it is being fixed!” he wrote.

Administration officials said Trump was annoyed by Mattis’ resignation letter, which included an implicit criticism of Trump’s disregard for allies.

Despite the falling out, the Pentagon said on Monday that Mattis authorized Trump’s withdrawal of U.S forces from Syria, one of the decisions that helped trigger his resignation.

The exit of Mattis, highly regarded by Republicans and Democrats alike, added to concerns over what many see as Trump’s unpredictable, go-it-alone approach to global security.

“To those few Senators who think I don’t like or appreciate being allied with other countries, they are wrong, I DO,” Trump also tweeted.

“What I don’t like, however, is when many of these same countries take advantage of their friendship with the United States.”

FILE PHOTO: U.S. President Donald Trump and U.S. Defense Secretary Jim Mattis attend the 119th Army-Navy football game at Lincoln Financial Field in Philadelphia, Pennsylvania, U.S. December 8, 2018. REUTERS/Jim Young/File Photo

“AMERICA IS RESPECTED AGAIN!” Trump added.

Mattis has been seen in Europe as firmly committed to the North Atlantic Treaty Organization (NATO) military alliance, while Trump warned European allies that the United States could withdraw its support unless they boost defense spending.

Trump also tweeted on Monday that Saudi Arabia had agreed “to spend the necessary money needed to help rebuild Syria, instead of the United States.”

It was not immediately clear whether Trump was referring to new funding from Saudi Arabia, which has already pledged money to cover costs for the next two years of stabilizing areas of Syria retaken from the Islamic State militant group.

The State Department was not immediately available for comment due to the partial U.S. government shutdown.

Trump made the decision last week to withdraw U.S. forces from Syria and pull out about half of the 14,000 U.S. troops in Afghanistan, against the advice of his top aides and U.S. commanders. The move brought withering criticism from fellow Republicans, Democrats and international allies.

Defense officials have cautioned against a timeline, but the withdrawal could begin in weeks. A senior official said a specific plan was being worked out.

Mattis’ abrupt resignation sparked concern among allies, who credit the retired Marine general with building trust and tempering isolationist impulses.

In his resignation letter, Mattis had said he would step down at the end of February to allow for a successor to be confirmed and to attend congressional hearings and a key NATO meeting.

But Trump Deputy Defense Secretary Patrick Shanahan will now take over on an acting basis beginning Jan. 1.