Senators resoundingly back text saying pullouts could allow ISIL and al-Qaeda re-group and destabilise both countries.
Senators from across party lines in the United States have backed an amendment opposing Donald Trump's plan to pull troops out of Syria and Afghanistan, in a strong rebuke of the Republican president's decision.
The text, which was passed on Monday by a majority of 70 to 26, says the troop withdrawal could allow the Islamic State of Iraq and the Levant (ISIL, also known as ISIS) group and al-Qaeda to re-group and destabilise both countries.
The measure was sponsored by Mitch McConnell, the Republican leader of the Senate who said last week it "would acknowledge the plain fact that al-Qaeda, ISIS and their affiliates in Syria and Afghanistan continue to pose a serious threat to our nation".
Al Jazeera's Mike Hanna, reporting from Washington, DC, said the result of the vote constituted "a sharp, bipartisan rebuke from the Senate of Trump".
The amendment, opposed by only three of the 53 Senate Republicans, will eventually be incorporated into a broader security bill on the Middle East which will be voted on later this week.
"Importantly, too, it's then got to go to the House of Representatives, where other aspects of the wider bill are likely to receive stern opposition from the Democrat-controlled body," Hanna said.
In a surprise move in December, Trump tweeted plans to remove the US's 2,000 troops out of Syria, arguing that ISIL had been defeated, even though his intelligence chiefs testified last week that the group's fighters remain a potent threat and are seeking a comeback.
Trump's declaration shocked allies and prompted the resignations of Defence Secretary Jim Mattis and Brett McGurk, who was the envoy to the US-led global coalition against ISIL. Last month, McGurk said " there is no plan for what's coming next" in Syria as it proceeds Trump's to pull troops out of the country.
His comments came days after a suicide bomber in mid-January killed four US military personnel and 15 others in the northern Syrian town of Manbij, in the deadliest attack on US troops since their deployment in the country in 2014.
The president has also vowed to pull half of the 14,000-strong US force from Afghanistan, where Washington has had a military presence since its 2001 invasion, citing the high cost in blood and treasure.
In December, senators, including prominent Republicans, inflicted another resounding rebuke to the president, holding Saudi Crown Prince Mohammed bin Salman responsible for the October 2 murder of Jamal Khashoggi after the Trump administration had been largely supportive of the kingdom's de facto ruler.