WASHINGTON (Reuters) - The Republican-led U.S. Senate backed largely symbolic legislation on Monday that broke with President Donald Trump by opposing plans for any abrupt withdrawal of troops from Syria and Afghanistan.

The Senate voted 70-26 in favor of a non-binding amendment, drafted by Majority Leader Mitch McConnell, saying it was the sense of the Senate that Islamist militant groups in both countries still pose a “serious threat” to the United States.

The amendment acknowledged progress against Islamic State and al Qaeda in Syria and Afghanistan but warned that “a precipitous withdrawal” could destabilize the region and create a vacuum that could be filled by Iran or Russia.

It called on the Trump administration to certify conditions had been met for the groups’ “enduring defeat” before any significant withdrawal from Syria or Afghanistan.

Before the vote, McConnell said he introduced the bill so the Senate could “speak clearly and directly about the importance of the” missions in Afghanistan and Syria.

Passage was expected, after the Senate voted to advance it in a procedural vote last week. After concerns from some Democrats, the Senate approved a change to the bill making it clear the amendment was not intended to be a declaration of war or authorization to use military force.

The vote added the amendment to a broader Middle East security bill making its way through Congress. The Senate voted 72-24 to advance the broader bill in a procedural vote on Monday after the amendment vote.

To become law, however, the bill would need to pass the Democratic-controlled House of Representatives, where it is unlikely to move without significant changes because of concerns about a provision addressing the “Boycott, Divest and Sanction” movement concerned with Israel’s treatment of the Palestinians.

The votes marked the second time in two months that the Senate supported a measure contradicting Trump’s foreign policy, although legislation to change his policies has yet to become law.

Several of Trump’s fellow Republicans strongly disagreed with his plans to withdraw 2,000 U.S. troops from Syria on the grounds that militants no longer pose a threat.

Senator Jim Risch, the Republican chairman of the Senate Foreign Relations Committee, disputed before Monday’s vote that the amendment rebuked or insulted Trump. “As I read it, it recognizes ... his effort for us to examine exactly what we are doing in these places,” Risch said.