President Donald Trump is pulling all U.S. troops out of Syria, a sudden policy shift that blindsided Congress and most senior officials at the Pentagon and State Department.

"We have won against ISIS. We have beaten them and we have beaten them badly," Trump said in a video posted on Twitter Wednesday night. "We have taken back the land and now it's time for our troops to come back home."

"Our boys, our young women, our men, they're all coming back," Trump added, expanding on a tweet he sent out earlier in the day. "And they're coming back now. We won. And that's the way we want it. And that's the way they want it."

But neither the president nor anyone else at the White House provided any details on changes in the Syria strategy that officials described as the next stage in the conflict.

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

The policy shift took many lawmakers and senior administration officials by surprise — and drew sharp denunciations from senators on both sides of the aisle. Several Middle East experts also criticized the shift in strategy, saying it will imperil the U.S.'s Kurdish allies and strengthen the hand of ISIS, Russia, Iran and Syrian leader Bashar al-Assad.

A senior administration official could not say whether all U.S. troops will leave Syria or give a timeline for any withdrawal. The official said the small pockets of ISIS that remain in the country serve as "no excuse to remain in perpetuity" and can be eliminated by local forces and regional troops.

The president changed his mind after his administration's recent declaration that American forces will not leave Syria until all Iranian troops and their proxies are gone, the official added.

"The issue here is that the President has made a decision," the senior administration official said. "He gets to do that. That’s his prerogative."

Trump's decision came as a surprise even to the U.S. special envoy for Syria, Joel Rayburn, according to a person familiar with the situation. Rayburn had been scheduled to speak at a private event on Syria policy on Wednesday morning. His appearance was canceled less than half an hour before it was scheduled to start, right around the time that Trump tweeted about having defeated ISIS in Syria.

Sen. Lindsey Graham of South Carolina was among the first Republicans to condemn the plan.

"An American withdrawal at this time would be a big win for ISIS, Iran, Bashar al Assad of Syria, and Russia," Graham said in a statement. "I fear it will lead to devastating consequences for our nation, the region, and throughout the world."

Graham called any plan for withdrawal in Syria "an Obama-like mistake" — a reference to President Barack Obama's decision to completely withdraw U.S. troops from Iraq in 2011, only to redeploy American forces there several years later to combat ISIS.

Trump has repeatedly criticized Obama's decision to withdraw from Iraq.

Sen. Marco Rubio, R-Fla., called withdrawing from Syria "a grave error that will have incredible consequences, potentially not fully thought through."

Not all senators criticized the plan. Sen. Rand Paul, R-K.Y., praised the president for defying the "naysayers on both sides of the aisle."

"We have troops in so many countries. We're fighting everywhere because no one knows how to declare victory," Paul said. "So I'm very supportive of the president's declaration. I'm very supportive of bringing the troops home."

White House press secretary Sarah Sanders said in a statement that the U.S. has defeated ISIS's "territorial caliphate," but she did not confirm that the administration is planning a complete withdrawal of American forces in Syria.

"These victories over ISIS in Syria do not signal the end of the Global Coalition or its campaign," Sanders said. "We have started returning United States troops home as we transition to the next phase of this campaign."

Sanders did not elaborate on what that next phase will look like.

The U.S. military confirms having 503 U.S. troops in Syria, even though defense officials acknowledge having had more than 2,000 there at times. The military mission is to defeat ISIS, but troops have also been used more for stabilization efforts in recent weeks.

Senior administration officials have said for months that the U.S. would remain in Syria as long as Iran continues to have a presence there.

Earlier this month, defense secretary James Mattis announced the U.S. had set up observation posts near the Turkish border.

Chairman of the Joint Chiefs of Staff Gen. Joseph Dunford said two weeks ago that "with regard to stabilization we still have a long way to go" in Syria.

After historic victories against ISIS, it’s time to bring our great young people home! pic.twitter.com/xoNjFzQFTp — Donald J. Trump (@realDonaldTrump) December 19, 2018

Dunford, speaking at a Washington Post event, said the U.S. had completed just 20 percent of its goal of training as many as 40,000 local forces in Syria. He declined to set a timeline for winding down America's presence there, noting that the military is focused on defeating ISIS and supporting the diplomatic effort led by Secretary of State Mike Pompeo.

Several hours after news of the planned troop pull-out broke, Defense Department spokeswoman Dana White confirmed it in a Twitter post but insisted the "campaign against ISIS is not over."

"We have started the process of returning U.S. troops home from Syria as we transition to the next phase of the campaign," White said. "For force protection and operational security reasons we will not provide further details. We will continue working with our partners and allies to defeat ISIS wherever it operates."

Two sources familiar with Trump's plans in Syria said a troop drawdown is part of a deal the U.S. has cut with Turkey. Turkey's foreign minister said in recent days that Trump had decided to withdraw from Syria.

Trump spoke with Turkish President Recep Tayyip Erdoğan by phone and met with him in Argentina last month.

A senior Turkish government official praised Trump's decision to withdrawal from Syria and said Turkey plans to move ahead with Erdoğan's threatened military operation against Kurds east of the Euphrates River.

"[The] decision is in line with the framework that emerged out of President Erdogan’s phone call with President Trump," the official told NBC News.

"To be clear, this decision won’t weaken Turkey’s resolve to combat all terrorist groups, including the [Kurdistan Workers' Party's] Syrian affiliate," he added.

A Syrian Democratic Forces (SDF) official, who spoke anonymously because the official is not authorized to speak publicly on the issue, said there are ongoing discussions between the SDF and U.S. military officials in Syria, but nothing has been finalized at this point and a time frame for any withdrawal remains unclear.

As far as the SDF are aware, there have been no movements of U.S. troops within Syria that would indicate a withdrawal is underway at the moment, the official said.

Charles Lister, a senior fellow at the Middle East Institute, said withdrawing from Syria would be an "extraordinarily short-sighted and naive" decision that would embolden the Assad regime and Iran while alienating the Kurdish forces who have fought with the U.S.

"It's a sad state of affairs when our key allies on the ground, who've shed blood and thousands of lives for our fight against ISIS, are to be well and truly abandoned," Lister said.

Nick Rasmussen, former director of the National Counterterrorism Center, said the move would hamper U.S. intelligence gathering in the region because those agencies rely on American forces for logistical and other support.

"That means we know less about what’s going on," said Rasmussen, who is an NBC and MSNBC contributor.

He also said any claim that ISIS has been "defeated" is misleading. "Obviously defeat implies something that simply isn’t true, that the organization lacks capacity to hurt us," Rasmussen said.

Even with a total withdrawal from Syria, the U.S. would still have a huge military presence in the Middle East with 5,200 troops across the border in Iraq.

At its height in 2014, ISIS established its "caliphate," controlling huge swathes of Syria and Iraq. The hard-line group ran a de facto government out of the ancient Syrian city of Raqqa, overseeing as much as 39,000 square miles of land with 8 million people within that region.

U.S.-backed forces finally retook Raqqa last year, as well as Hajin, the last town held by ISIS in Syria, earlier this month.

The Pentagon did not formally announce the withdrawal on Wednesday. "At this time, we continue to work by, with and through our partners in the region," said Col. Rob Manning, a Pentagon spokesman.