Democrats in the House of Representatives on Friday passed an amendment that would sharply restrict President Donald Trump’s ability to attack Iran without congressional authorization, attaching the language to an annual must-pass defense bill.

The measure, which was sponsored by California Democrat Ro Khanna and Florida Republican Matthew Gaetz, would prohibit the Pentagon from spending money on any military action against Iran unless Congress has declared war or passed a resolution authorizing the administration to use force. The bill contains an exception for emergency situations in which U.S. armed forces are under attack.

The measure is likely to face resistance from Senate Republicans, who are expected to fight to strip it out when the House and Senate versions of the bill are reconciled. A similar measure introduced by Democratic Sens. Tom Udall of New Mexico and Virginia’s Tim Kaine and Republicans Mike Lee of Utah and Rand Paul of Kentucky failed to pass the Senate last month despite garnering 50 votes in favor and only 40 against. Due to parliamentary maneuvering by Senate Leader Mitch McConnell, it needed 60 votes to pass.

Friday’s 251-170 vote drew 27 Republicans and was a remarkable display of unity for House Democrats on an issue that frequently sparks dissent within the caucus. House Speaker Nancy Pelosi argued in support of the measure, which was co-sponsored by Rep. Adam Smith, D-Wash., chair of the House Armed Services Committee, and Rep. Elliot Engel, D-N.Y., the top Democrat on the House Foreign Affairs Committee. According to two Democratic sources, even the leadership of the centrist New Democrat coalition whipped votes in favor of the amendment.

“With more than 25 Republicans voting in favor of passage, this amendment is proof that opposition to war with Iran transcends partisan politics,” Khanna said in a statement after the vote. “Some of the President’s closest allies voted for this amendment. Americans came together around the idea that we must avoid a war with Iran.”

The Trump administration lobbied heavily against the measure in the Senate. In a letter to the Senate Armed Services Committee, Under Secretary of Defense for Policy John Rood wrote that it could “embolden Iran to further provocations.”

It is still unclear how the amendment could affect the final defense spending bill or its passage. Trump has already threatened to veto the bill over cuts to the full $750 billion in spending that the Senate version authorized. The White House on Wednesday also released a 10-page list of policy grievances related to the bill, though the possible amendment on Iran was not among them.

Congress has historically been reluctant to limit the president’s authority to conduct military operations overseas, but Friday’s vote marks the second time in the past year that House Democrats have voted to rein in Trump’s war powers. In April, Congress passed a resolution directing Trump to stop U.S. participation in hostilities in Yemen, but the Senate failed to override his veto.