A Republican-backed effort to derail the Iran nuclear agreement has been narrowly blocked in the US Senate.
The vote on Thursday cleared the way for the deal's implementation, handing US President Barack Obama perhaps the greatest foreign policy victory of his six years in office.
Forty Democrats and two independents voted to block a resolution disapproving of the pact in the 100-member chamber, one more than the minimum needed to keep it from advancing.
"This vote is a victory for diplomacy, for American national security, and for the safety and security of the world," Obama said in a statement after a vote he termed "an historic step forward".
RELATED: Iran 'ready' to talk to US and Saudi Arabia about Syria
Senate Republicans insisted the fight was not over, however.
The Senate's Republican majority leader, Mitch McConnell, immediately took steps to clear the way for the chamber to consider the matter again, hoping some Democrats would vote differently next time.
"We'll revisit the issue next week and see if maybe any folks want to change their minds," he said in a speech angrily denouncing the vote.
Under a law Obama signed in May, Congress has a 60-day period ending on September 17 to pass a resolution disapproving of the international agreement.
If such a resolution were to pass, and survive Obama's promised veto, it would bar the president from waiving many US sanctions on Tehran, a key component of the nuclear deal.
But there was no sign any votes would change, and Senate Democratic leader Harry Reid bluntly responded: "This matter is over with."
Reid urged McConnell to move on to other legislation, including bills providing long-term highway and transportation funding and urgent legislation to fund the government in the fiscal year beginning October 1 to avoid a government shutdown.
"This is a situation where he's [McConnell] lost the vote and it's a situation where he is just not in touch with reality as it exists," Reid said.
The defeat came despite an intense $40m lobbying campaign against the agreement, largely by conservative pro-Israel groups.
Although the nuclear deal was reached after two years of negotiations with Iran by the US, Britain, France, Germany, Russia and China, the government of Israeli Prime Minister Benjamin Netanyahu vociferously opposed the agreement.
Netanyahu said the deal demanded too little from Iran in exchange for sanctions relief and would strengthen a country he sees as a threat to Israel's existence.
House Republicans vow to fight on
Republican in the House of Representatives meanwhile pushed ahead with legislation critical of the nuclear accord.
They raised the possibility of filing suit against Obama over the Iran deal or attaching Iran-related legislation to a bill funding the government.
"This is a bad deal with decades-long consequences for the security of the American people and our allies. And we'll use every tool at our disposal to stop, slow, and delay this agreement from being fully implemented," House Speaker John Boehner told a news conference.