U.S. President Donald Trump speaking at a news conference during a NATO Summit in July this year | Jasper Juinen/Getty Images Trump blindsides allies at NATO Troop withdrawals from Syria and Afghanistan didn’t leave only Jim Mattis feeling sidelined.

NATO allies were blindsided.

U.S. President Donald Trump's abrupt decisions on troop withdrawals in Syria and Afghanistan, which also prompted the resignation of Defense Secretary Jim Mattis, have left America's closest allies and officials at NATO headquarters feeling like victims of an ambush.

With no advance notice or preparation of Trump's plans, allies committed by the North Atlantic Treaty to common defense have found themselves scouring Twitter for clues as to what the U.S. commander-in-chief might do next.

Particularly jarring for NATO was word of Trump's plans for a withdrawal of 7,000 troops from Afghanistan, which have been described in news accounts, but the president himself has not even mentioned on Twitter — unlike the Syria withdrawal which he first announced with a tweet on Wednesday declaring victory against the Islamic State.

We have defeated ISIS in Syria, my only reason for being there during the Trump Presidency. — Donald J. Trump (@realDonaldTrump) December 19, 2018

Since 2015, NATO has led a joint mission in Afghanistan, Operation Resolute Support, to train and advise the Afghan security forces. Currently, the operation involves approximately 16,000 troops and a total of 41 nations.

"We have seen the reports," NATO spokeswoman Oana Lungescu said in a statement in response to a request for comment from POLITICO. "For any comments, I refer you to the U.S. authorities."

NATO allies were hardly alone in being left in the dark by Trump. Neither the U.S. Congress nor the Afghan government were briefed on his withdrawal plans in advance. The U.S. also leads a 74-nation Defeat-ISIS coalition, whose members also apparently received no notice of the Syria withdrawal.

Officials said that NATO Secretary-General Jens Stoltenberg spoke by telephone on Wednesday with U.S. Secretary of State Mike Pompeo about the U.S. "posture" in Syria.

In response to a request for comment, a spokesman for the U.S. mission to NATO said: “The U.S. remains committed to the Alliance and to working with allies to deter our adversaries and defend our citizens.”

Lungescu, the NATO spokeswoman, said in her statement that the alliance remained committed to Operation Resolute Support. She noted that the Afghan army and police have the main responsibility for security in the country, and that NATO was intent on preventing Afghanistan from ever returning to its prior role as a base for terrorists.

"In general, let me remind you that the Afghan army and police have been fully in charge of the security of Afghanistan for over four years," Lungescu said. "They are a brave, committed and increasingly capable force, who have ensured the security of the parliamentary elections earlier this year."

She added, "NATO leads a coalition of 41 nations in our Resolute Support Mission. Our aim is to train, advise and assist the Afghan forces, as they create the conditions for peace. At the NATO summit in July, allied leaders also agreed to extend funding for the Afghan security forces until 2024. Earlier this month, NATO foreign ministers expressed steadfast commitment to ensuring long-term security and stability in Afghanistan. Our engagement is important to ensure that Afghanistan never again becomes a safe haven for international terrorists who could threaten us at home."

The U.S. ambassador to NATO, Kay Bailey Hutchison, participated in an EU conference on non-proliferation that was held on Tuesday and Wednesday, but she has since left Brussels for the holiday break.

Leading voices in the U.S. Congress, including some strong political supporters of Trump like Republican Senator Lindsey Graham of South Carolina, have reacted with a mix of shock and dismay to the troop withdrawal decisions.

Trump, however, has insisted that the pullout from Syria should not have come as a surprise.

Getting out of Syria was no surprise. I’ve been campaigning on it for years, and six months ago, when I very publicly wanted to do it, I agreed to stay longer. Russia, Iran, Syria & others are the local enemy of ISIS. We were doing there work. Time to come home & rebuild. #MAGA — Donald J. Trump (@realDonaldTrump) December 20, 2018

Critics of Trump's decisions have said that it will clear the way for Russia and Iran to exert greater influence over events in Syria. Russian President Vladimir Putin praised Trump's decision to withdraw from Syria, but Trump has insisted that Russia, Iran and Syria are not happy about his decision.

In a tweet on Thursday, Trump said of Russia, Iran and Syria, "now they will have to fight ISIS and others, who they hate, without us." It's not clear how the need to continue fighting ISIS fits with Trump's declaration that ISIS had been defeated. In that tweet, he added, "ISIS hits us they are doomed!"

NATO allies have struggled with Trump's unpredictability throughout his presidency. At a leaders' summit in the summer, he issued a thinly veiled threat to pull out of the alliance unless allies more quickly ramped up their annual national military spending toward a NATO goal of 2 percent of GDP.

They have also struggled to deal with his unilateral actions, including his plan to withdraw from the Intermediate-range Nuclear Forces (INF) treaty with Russia. Allies support Trump's contention that Russia has violated the treaty, but were left pleading with the U.S. administration not to withdraw abruptly but rather allow 60 days for an effort to persuade Moscow to come back into compliance — a longshot bid given the Kremlin insists it is the U.S. that is violating the treaty.

Trump ultimately agreed to the allies' request. As for Trump's withdrawal from Syria, Putin called it a "correct" decision.