The United States and Germany will unveil a deal on July 21 that maps out consequences for Russia if it uses the Nord Stream 2 gas pipeline to harm Ukraine or other Eastern European countries, but the deal faces opposition in both countries.

The agreement, hammered out by senior U.S. and German officials and first reported by Reuters on July 19, will resolve a long-standing dispute over the $11 billion pipeline, now 98% complete, being built under the Baltic Sea to carry gas from Russia's Arctic region to Germany.

U.S. officials continue to oppose the pipeline, but say the accord would mitigate the possibility of Russia using energy as a weapon against Ukraine and other countries in the region.

Sources said Germany also agreed to take potential unspecified actions against Russia if it cut off energy supplies to Ukraine, in addition to seeking European Union sanctions, but details about those actions—or what specific behavior by Russia would trigger them—were not immediately available.

Germany would also contribute to a new $1 billion fund aimed at improving Ukraine's energy independence, including through investments in green hydrogen, according to the sources.

Reports about the agreement drew immediate jeers from lawmakers in both Germany and the United States.

Republican Senator Ted Cruz, who has been holding up President Joe Biden's ambassadorial nominations over his concerns about Nord Stream 2, said the reported agreement would be "a generational geopolitical win for Putin and a catastrophe for the United States and our allies."

Cruz and other lawmakers are furious at Biden for waiving congressionally mandated sanctions against the pipeline.

The agreement will avert, for now, the resumption of sanctions against Nord Stream 2 AG and its chief executive. Biden waived those sanctions in May to allow time for both sides to negotiate a way forward.

Some U.S. lawmakers have already introduced an amendment that would prevent the Biden administration from continuing to waive the sanctions, although the prospects for passage remain uncertain.

U.S. officials have sought to reassure lawmakers that the Biden administration will reserve the right to use sanctions on a case-by-case basis, in line with U.S. law.

In Germany, top members of the environmentalist Greens party, called the reported agreement "a bitter setback for climate protection" that would benefit Russian President Vladimir Putin and weaken Ukraine.

"At a time when Putin is putting massive rhetorical and military pressure on Ukraine and once again questioning the country's sovereignty, Washington and Berlin are sending the wrong signals to Moscow," said Oliver Krischer, vice-chairman of the party's parliamentary group, and Manuel Sarrazin, spokesman for Eastern European policy.