WASHINGTON (Reuters) - The U.S. Senate on Friday defeated legislation that would have barred President Donald Trump from launching an attack on Iran without first obtaining the approval of Congress, except in self-defense.

FILE PHOTO: U.S. President Donald Trump talks to reporters as he departs for travel to the G20 Summit in Osaka, Japan at the White House in Washington, U.S., June 26, 2019. REUTERS/Jonathan Ernst

The measure was defeated 50 to 40, ensuring that the measure would not get the 60 needed to pass the Republican-majority Senate as an amendment to an annual defense policy bill.

Ten senators did not vote.

U.S.-Iranian military tensions have risen over the past two months, after Trump a year ago withdrew the United States from an international nuclear deal with Tehran and world powers.

The bill, the National Defense Authorization Act, or NDAA, passed the Senate on Thursday, but Senate leaders made the unusual decision to allow the amendment vote on Friday after a handful of Republicans joined Democrats in calling for debate on the matter.

They also agreed that the voting, which began at 5 a.m. EDT, would last through most of the day to allow Democrats running for president to return from a debate in Miami. The vote concluded 10 hours later, at 3 p.m. EDT.

Republican opponents of the legislation argued it would impose unnecessary restrictions on Trump if he faced a threat from Iran.

Supporters said it was necessary to ensure that Congress retains its constitutional right to authorize the use of military force and to lessen the chance of a miscalculation that could plunge the country into prolonged conflict.

A week ago, Washington called off air strikes just minutes before impact.

On Friday, Iran said European countries had offered too little at last-ditch talks to persuade Iran to back off from its plans to breach limits imposed by that agreement.