MEMBERS of Congress do not agree on much, but on July 25th, after a bipartisan deal, the House of Representatives voted by 419 votes to three for a bill that toughens sanctions on Russia. This is punishment both for Russia’s meddling in the election that brought President Donald Trump to power, and for its continuing aggression in Ukraine. (The bill also includes new sanctions against Iran and North Korea.) As The Economist went to press, the Senate was expected to follow suit: senators endorsed a similar bill 98-2 in June. The aim is to get the legislation passed before the summer recess and sent to the president for his signature.

The implications are momentous. Mr Trump had hoped to lift the existing package of sanctions on Russia at some point. Now he has been stripped of his presidential authority to do so. Since the vote was almost unanimous, he may have no option but to accept it with as much good grace as he can muster. He could veto it, but presidential vetoes can be overridden by a two-thirds majority in both chambers, which in this instance could be achieved.

The bill both locks in and extends previous sanctions aimed at Russia’s energy firms and banks. It also now targets any entity that does business with Russia’s defence or intelligence sectors—a measure that could threaten buyers of Russian weapons with secondary sanctions. This is a blow to Mr Trump, who made it clear during his campaign that he wanted improved ties with Moscow. It now appears that many of the undeclared meetings that have subsequently come to light between Mr Trump’s inner circle of advisers—Michael Flynn, Jared Kushner and Donald Trump junior—and an assortment of Russians with links of various directness to the Kremlin, most notably Sergey Kislyak, the ubiquitous and gregarious former Washington ambassador, were aimed at thawing relations.

Vladimir Putin—who, beyond the reasonable doubt of America’s intelligence agencies (if not its president), authorised the election-hacking operation—may have had reason to believe that Mr Trump, once in the White House, would find a way to relax sanctions. American and European Union sanctions have dragged down Russia’s economy, which, already reeling from low energy prices, contracted sharply in 2015 and has stagnated since.

By overreaching, Mr Trump and Mr Putin have made the relaxation of sanctions politically toxic. That is bad enough for Mr Trump, but his humiliation does not end there. The Republican majority in Congress has, in essence, declared that it does not trust a president from its own party to serve the national interest when it comes to dealing with Russia. There is no other way to interpret the provision in the legislation to prevent the president from suspending sanctions by executive order, in the absence of congressional approval, as Barack Obama did in order to secure the nuclear deal with Iran.

To lift Ukraine-related sanctions, Mr Trump would have to certify by letter that the conditions which had led to them no longer applied—in other words, that Russia’s annexation of Crimea and its support for separatists in the east had ceased. Similarly, the new sanctions brought in to punish Russia for its cyber-attacks could be eased only if Mr Trump could show solid proof that Russia was actively and successfully clamping down on such activities. After receiving such a letter, Congress would then have 30 days to decide whether the president had made his case convincingly. Tellingly, the same conditions do not apply to the sanctions on North Korea and Iran.

Foreign-policy practitioners, including Mr Trump’s secretary of state, Rex Tillerson, have warned that this creates a potentially damaging precedent. By deliberately tying this president’s hands over Russia, albeit with good reason, Congress risks undermining the ability of future administrations to conduct diplomacy, which often requires flexibility in light of changing circumstances. The bar for eventually removing sanctions will be so high that, in effect, they become permanent.

America’s European allies are worried too, both about the longer-term effects of this bill and the immediate impact of some of the new measures contained in it. The penalties that could be levied on European firms taking part in the controversial Nord Stream 2 pipeline project, which on present plans will start pumping gas from Russia to Germany in 2019, have already raised concerns in Berlin and Brussels. Those qualms are not shared by all EU countries, especially former members of the Soviet bloc, such as Poland and the Baltic states, who want to reduce their dependence on Russian energy.

How might Mr Trump respond to such a setback to his ability to conduct foreign policy on his own terms? One possibility is that it will increase his determination to find a way out of the Iran nuclear deal, which, like Obamacare, he once pledged to scrap. For America’s nuclear-related sanctions on Iran to remain suspended—a key condition of the 2015 agreement—the State Department must inform Congress whether it believes Iran to be in full compliance every 90 days. So far, Mr Trump has twice reluctantly agreed to certify and thus renew the presidential sanctions waiver. But when he did so on July 17th, it was only after kicking back hard against the recommendation of most of his senior foreign-policy and national-security team.

The White House now seems to be looking for a way to get out of certifying the Iran deal when it comes up for renewal in October. To that end, the president has ordered White House staffers to bypass Mr Tillerson and to come up with the evidence and arguments he needs to undo the deal that the State Department has failed to provide. Mr Tillerson is reported to be fed up with his lot.

It is still not clear whether Mr Trump wants to kill the Iran deal or try and renegotiate it—something that the other parties to it (Britain, France, Germany, Russia, China and the EU) have already ruled out. But on Iran, unlike Russia, Mr Trump can almost certainly rely on the support of Republicans in Congress for whatever he decides to do. After the ignominy of losing control over sanctions against Russia, the urge to appear decisive and in control may be hard for Mr Trump to resist.