The U.S. and Germany will take action against Russia if it uses the Nord Stream 2 gas pipeline to harm Ukraine or other Eastern European countries, according to two sources familiar with a bilateral agreement expected on July 21.

The agreement, hammered out in recent months by senior U.S. and German officials and first reported by Reuters on July 20, 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 insist they continue to oppose the pipeline, but said the U.S.-German agreement would mitigate the possibility of Russia using energy as a weapon against Ukraine and other countries in the region.

The U.S. worries that Russia could cut off energy supplies to Ukraine or other countries as a form of aggression, and also fears that Ukraine will miss out on transit fees for gas now carried on an existing land-based pipeline.

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

But the Biden administration reserves the right to use sanctions on a case-by-case basis, in line with U.S. law, one of the sources said.

Germany also agreed to contribute to a new $1 billion fund to help Ukraine transition to cleaner sources of energy and improve its energy security, said one of the sources.

Details about the funding were not immediately available, but the money is likely to come from private sources, backed with government guarantees, one of the sources said.

Bloomberg News reported earlier that Germany would provide an initial investment of $175 million.

Biden and German Chancellor Angela Merkel failed to reach an agreement on the pipeline when they met last week, but said they agreed Moscow must not be allowed to use energy as a weapon against its neighbors.

At the time, Merkel said Germany had a number of instruments at its disposal, including the possibility of imposing sanctions through the EU, to respond to Russia, if needed.

‘Geopolitical Project’

Officials from both countries have continued working out the details in recent days, and senior State Department official Derek Chollet visited Ukraine on July 20 to discuss the deal. State Department spokesman Ned Price told reporters on July 20 that Washington still viewed the pipeline as a bad deal for Germany and Europe but decided that sanctions were unlikely to halt the project and focused instead on addressing Russia's potential use of energy as a weapon.

“We continue to oppose the Nord Stream 2 pipeline. We view it as a Kremlin geopolitical project that is intended to expand Russia’s influence over Europe's energy resources and to circumvent Ukraine.”

Price declined to address the reported agreement, but said Germany had “put forward useful proposals” and they had made progress on the shared goal of ensuring that “Russia cannot weaponize energy flows.”

Biden faces pressure from Congress to block the pipeline.

“Regardless of the foreign policy outcome the administration thinks it has achieved, there are still mandatory sanctions the administration has not imposed,” Senator James Risch, the top Republican on the Senate Foreign Relations Committee, said in a statement, referring to existing U.S. law.