Late on Friday, President Donald Trump is set to sign legislation sanctioning a gas pipeline project that would run from Russia to Germany. The Ukrainian government has worked to stop the project. The German government, meanwhile, opposes the sanctions. In a final series of meetings aiming to stave them off, Berlin officials made statements that frustrated both Ukrainian and U.S. officials, according to five sources with knowledge of the talks.

The Germans have intimated that the U.S. will have a harder time holding together Western sanctions on Russia if it blocks the Nord Stream 2 (NS2) pipeline, according to three of those sources, and they suggest the American action could endanger crucial gas transit talks among Germany, Ukraine, and Russia.

Berlin also says success of those talks is vital to American national security, and that this justifies shielding the project from the sanctions designed to stop it.

One U.S. government official said the Germans “are threatening Ukraine and jeopardizing transatlantic security by holding out the possibility of a gas transit deal in order to extort us into allowing a malign Russian project to continue.”

“ At the heart of it all is a simple question: What kind of relationship will Western Europe have with Russia? ”

A German embassy spokesperson said those gas transit talks are nearing “the critical final stage” and Berlin hopes that Trump will waive the sanctions:

“The remaining technical details are currently still being finalized between the two parties,” the spokesperson said. “So the negotiations have now reached the critical final stage. Precisely because we are united in the goal of long-term substantial gas transit through Ukraine, we should not now strain the negotiations through unilateral actions. Rather, we should work together to ensure the future transit of gas through Ukraine. It is therefore crucial that the NS2 sanctions are not imposed before (or after) the trilateral negotiations are successfully concluded and, instead, a national security waiver, as envisaged under the law, is granted.”

The private conversations between German and U.S. officials have covered a maze of often byzantine topics: pipeline construction, gas transit negotiations, and sanctions enforcement. But at the heart of it all is a simple question: What kind of relationship will Western Europe have with Russia?

For Ukraine, it’s existential; Kyiv views completion of the Nord Stream 2 pipeline as an urgent national security threat. Meanwhile, German government officials have pounded the halls of Congress lobbying members to withhold their opposition.

“The Ukrainians see German efforts to undermine Nord Stream 2 sanctions as a direct threat to their defense and national security,” said a source close to Ukrainian President Volodymyr Zelensky’s administration.

Opponents of the project argue that Russia uses its vast reserves of cheap gas as a vector of malign influence. Among its tactics: shutting off gas of its geopolitical rivals. But efforts to sanction it have been slow moving. And while many members of Congress are loath to oppose in public anything viewed as anti-Kremlin, Sen. Rand Paul has criticized the sanctions as an attack on America’s European allies.

“If we continue down this road––of drawing lines in the sand and treating our friends the same way we treat our adversaries––then we will have no one to blame but ourselves when we find ourselves with fewer friends,” he wrote in a letter that The Daily Beast obtained.

According to two people present for meetings and a third briefed on them, German officials indicated that the new sanctions could constrain their ability to help the U.S. hold together its current sanctions on Russia. The U.S. rolled out those sanctions after Russian military intervention in Ukraine’s Crimean Peninsula in 2014.

“ Kyiv is acutely concerned about the pipeline. ”

The Germans indicated that they are already struggling to hold together the European Union consensus in support of those sanctions, according to one source who was present for a meeting between American and German officials. They intimated they may not be able to continue to do so if the U.S. blocks the pipeline project.

A second source said German officials were blunt about the American need for help holding the line on Russia. “We are the people propping these sanctions up, and you need us,” said one source who was in the meetings, paraphrasing the Germans.

The U.S. government, along with Central and Eastern European countries, has opposed the pipeline, arguing it will grow Russian President Vladimir Putin’s influence over Europe.

Kyiv is acutely concerned about the pipeline; currently, Russian gas flowing to Europe goes through Ukraine, which gives Kyiv a measure of leverage over Moscow––which it uses to stave off Russian efforts to escalate violence in the Eastern part of the country. Ukraine also makes more than $2 billion a year in transit fees to move the gas, a meaningful sum of money to the nation’s war-wracked economy.

The movement of that gas has been the focus of trilateral talks among Germany, Russia, and Ukraine since 2014. The Russians want the Ukrainians to abandon multi-billion-dollar arbitration claims they have made in Stockholm, according to two sources familiar with the talks; in exchange, the parties have discussed the possibility of continuing to move some gas through Ukraine after the construction of Nord Stream 2. It is unclear how any such agreement would be enforced.

In their conversations with Americans, German officials have indicated that sanctions on the pipeline could threaten those talks. But Ukraine sources say the claim is meaningless, since no deal is final. A European Union official tweeted on Dec. 19 that the three parties have agreed in principle on a new gas transit deal, but a source close to Ukraine’s state-owned energy company Naftogaz––a participant in the talks––said nothing has been signed.

The Germans’ invocation of the trilateral talks has angered some U.S. government officials.

Germany expelled two Russian diplomats earlier this year after a man traveling on a Russian passport assassinated a former Chechen fighter in Berlin. One of those expelled diplomats was actually a Russian intelligence officer who tried to persuade German officials to lobby for the pipeline project, according to an investigation by the German newspaper Bild and the investigative organization Bellingcat.

American lawmakers, meanwhile, are pushing the company building the pipeline to stop as soon as Trump signs the bill. Senators Ted Cruz (R-TX) and Ron Johnson (R-WI) sent a letter to the CEO of AllSeas––the shipping company laying the final leg of the pipeline––demanding compliance with the sanctions as soon as they are signed:

“You face a binary choice: stop NOW, and leave the pipeline unfinished (the express intention of the sanctions legislation, which we authored), or make a foolish attempt to rush to complete the pipeline and risk putting your company out of business forever.”