The Senate failed to muster enough votes Friday to approve a measure that would have insisted President Trump come to Congress before engaging militarily with Iran, except in the case of self-defense.

The measure, a proposed amendment to the annual defense bill, needed 60 votes to be included in the $750 billion authorization senators passed Thursday. It encountered significant opposition from Republicans, who argued that it was unnecessary — and potentially dangerous, in sending a message to Iran that Congress might undermine the commander in chief in the midst of an escalating conflict.

The vote was 50 to 40, with four Republicans joining Democrats to support the measure: Sens. Jerry Moran (Kan.), Susan Collins (Maine), Mike Lee (Utah) and Rand Paul (Ky.). There were 10 no-shows: Democratic Sen. Christopher A. Coons (Del.) and Republican Sens. Marsha Blackburn (Tenn.), Roy Blunt (Mo.), Mike Braun (Ind.), Richard Burr (N.C.), Kevin Cramer (N.D.), James M. Inhofe (Okla.), Pat Roberts (Kan.), Mike Rounds (S.D.) and Rick Scott (Fla.).

“The timing couldn’t be worse,” Sen. Marco Rubio (R-Fla.) said Thursday, arguing that the amendment was “just not necessary” given the president’s powers to direct the military. “The redundancy is actually damaging . . . It’s only going to reinforce this belief among some in the regime that they can go further than they can.”

Those supporting the effort rejected the argument that the president would fully respect Congress’s authority to declare war — or stick to a plan about when and where to respond to provocations with military force.

“They’re trying to create excuses for why we should ignore the Constitution and open the door to war with Iran,” Sen. Tom Udall (D-N.M.), an amendment co-author, said Thursday. “President Trump has said he was 10 minutes away from doing just that.”

The debate now moves to the Democratic-led House, where lawmakers are expected to include a similar restriction in their version of the defense bill. Debate begins on the House floor next month.

The Senate and the House will then have to combine the two versions of the defense bill. Iran is one of several matters — along with nuclear weapons investments, the diversion of military resources to the U.S.-Mexico border and overall funding levels for the Pentagon — that promise to be contentious.

Sen. Tim Kaine (D-Va.), who co-authored the Senate’s Iran amendment, surmised that it stood a good chance of being included in the final product “because of the fact that we did get a majority here [in the Senate] and we’re going to get a strong vote in the House.”

Mike DeBonis and Emily Davies contributed to this report.