WASHINGTON-- U.S. President Barack Obama achieved perhaps the greatest foreign policy victory of his six years in office on Thursday, when a Republican-backed effort to kill the Iran nuclear agreement was narrowly blocked in the U.S. Senate, clearing the way for the deal's implementation. 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." 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 Sept. 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 U.S. 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 Oct. 1 and 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 $40 million 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 United States, 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. 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. Republicans are already using the Iran deal in campaigning against Democrats in the 2016 election. On Wednesday, Republican presidential candidates Donald Trump and Ted Cruz were among the headliners at a raucous anti-deal rally on the lawn of the U.S. Capitol. But House Republicans split over how to handle the agreement, after weeks of marching in lockstep in opposition to the nuclear deal, announced on July 14. This week, as Democrats gathered more than enough votes to protect the nuclear deal, House Republicans came up with their own plan for three Iran-related votes after a rebellion by some of the party's most conservative lawmakers. On Thursday, House members voted strictly along party lines, with 245 Republicans voting yes and 186 Democrats voting no, to pass a resolution finding that Obama had not complied with terms of the Iran nuclear review act he signed in May. Some Republicans argued that the 60-day window for reviewing the deal had never opened because Obama had not sent Congress details of what they termed "secret side deals" regarding inspections of Iran's nuclear facilities. The House was to vote on Friday on two other Iran-related measures, a resolution of approval of the Iran deal that Republicans hoped to defeat by a wide margin, and a separate one that would bar Obama from waiving sanctions. But none of the three would have a direct impact on the nuclear pact similar to that of a disapproval resolution, a mechanism outlined in the Iran review act. The House has not scheduled a vote on its own resolution of disapproval. And there are no plans now for the Senate to vote on legislation similar to the three measures being considered in the House. The 42 members of the Senate Democratic caucus who supported the nuclear deal on Thursday are also far more than the 34 senators whose votes would be needed to sustain an Obama veto.