Germany agreed on July 21 to warn Russia of potential sanctions and to support Ukraine’s energy sector financially in a deal with the US to settle a bitter rift between the allies over the Nord Stream 2 gas pipeline.

President Joe Biden’s Republican rivals swiftly denounced the agreement and said it would embolden President Vladimir Putin, but the administration said it was too late to stop the pipeline and the deal instead secured a better outcome.

“This is a bad situation and a bad pipeline but we need to help protect Ukraine and I feel that we have made some significant steps in that direction,” Victoria Nuland, the undersecretary of state for political affairs, said as she unveiled details before a Senate hearing.

Biden, who welcomed Chancellor Angela Merkel last week, already waived the toughest sanctions required by Congress over Nord Stream 2 which will connect Russia and Germany through the Baltic Sea and is expected to be complete within weeks.

The pipeline has been vigorously opposed by many of Russia’s neighbours – especially Ukraine, which has been battling pro-Moscow separatists since 2014.

Ukraine sees the flow of Russian gas through its territory en route to Europe both as leverage and an indispensable financial boon, with transit fees bringing some $3 billion a year.

In a joint statement with the US, Germany said it had committed to respond to Russia if Ukraine’s fears materialise.

“Should Russia attempt to use energy as a weapon or commit further aggressive acts against Ukraine, Germany will take action at the national level and press for effective measures at the European level, including sanctions, to limit Russian export capabilities to Europe in the energy sector,” it said.

Germany also said it would use all leverage to persuade Russia to extend by up to 10 years a gas transit agreement through Ukraine that is set to expire at the end of 2024, including by appointing a special envoy by September 1 to support negotiations.

The Kremlin said Merkel raised an extension in transit rights in a call on July 21 with Putin and also that the two leaders were “satisfied” that Nord Stream 2 was near completion.

Ukraine and Poland made clear that they still opposed the pipeline, saying together that it threatens Central Europe.

Germany also agreed to help Ukraine reduce reliance on Russian energy including by setting up a fund of at least $1 billion.

Addressing another key priority of Merkel and Biden, the fund will support renewable energy and reductions in carbon emissions blamed for climate change.

In a show of support for Kiev, the White House announced that Biden will receive Ukrainian President Volodymyr Zelensky at the White House on August 30.

Germany, which had intense friction with former president Donald Trump, has hailed the approach of Biden as a revitalisation of the alliance.

“I am relieved that we have found a constructive solution regarding Nord Stream 2,” German foreign minister Heiko Maas said.

US officials said they expected Germany to adhere to its promises even after Merkel leaves office later this year.