Europe is facing a natural-gas shortage just as Russia is completing a controversial pipeline to Germany, increasing President Vladimir Putin’s leverage over the continent’s energy flows.

Europe’s gas stores are at their lowest levels for years after demand rebounded from a pandemic-induced low that had led producers to slash output. As a result, prices are hitting record levels and utilities are firing up coal-fired power stations to keep their own costs down.

Despite this, Russia, Europe’s biggest gas supplier, has declined to book big additional flows through pipelines in Ukraine, which are running below full capacity.

A large share of Russian gas exports to Europe transits through neighbor Ukraine, but that is expected to change after Russia completes construction of the Nord Stream 2 pipeline, which the company running the construction expects to happen this month. This will allow Moscow to export directly to Germany and bypass Ukraine and Poland, whose governments are critical of Moscow.

The U.S. fears Russia will use Nord Stream 2 to wield influence over Europe and punish pro-Western Ukraine and other countries that the pipeline circumvents by depriving them of the transit fees they charge on Europe-bound Russian gas, raising gas prices or potentially starving them of gas altogether. But the Biden administration waived sanctions on the project in May as it sought improved ties with Germany.

“Even without Nord Stream 2 built, we are already seeing who pushes the gas price in Europe up,” said Ukrainian President Volodymyr Zelensky on Sunday after meeting with German Chancellor Angela Merkel, a supporter of Nord Stream 2. “The project is only beneficial for the Russian Federation.”

The pipeline is “a dangerous weapon not only for Ukraine but for all of Europe,” said Mr. Zelensky, whose country has resisted a Russian military and economic campaign since 2014 to drag it back into Moscow’s orbit.

Russia and Germany say Nord Stream 2 is a commercial project, providing a shorter and cheaper route for gas supplies.

With Nord Stream 2 nearing completion, the West is pressing Russia to extend a contract for gas transit via Ukraine beyond 2024. Ms. Merkel backed the demand at a news conference following a meeting with Mr. Putin in Russia on Friday. Mr. Putin said Russia was ready to do so but was awaiting details on how much gas Europe would require.

German Chancellor Angela Merkel met with Russian President Vladimir Putin at the Kremlin last week.

Photo: pool/Reuters

During a subsequent visit in Kyiv on Sunday, Ms. Merkel raised the possibility of further sanctions on Russia “if the suspicion that the pipeline is being used as a weapon is substantiated,” without elaborating.

The European Union has long sought to cut its reliance on Russian gas, building facilities to import liquefied natural gas, backing a new pipeline from Azerbaijan and employing its regulatory powers to promote diversification of sources and integration of members’ gas markets.

Still, Russia accounted for half of gas imports by the EU in the first quarter of this year, well ahead of Norway on 24%, according to the European Commission.

Nord Stream 2 AG, the unit of Russian state-controlled gas giant Gazprom PJSC that is building the pipeline, says Europe will need increasing amounts of Russian gas in addition to gas from other sources to meet demand as domestic fossil-fuel production shrinks in the coming years.

Mr. Putin said Friday that less than 10 miles of pipe needed to be laid to complete Nord Stream 2, which will double the capacity of an existing link to Germany to 110 billion cubic meters a year. Gazprom says it sold 175 billion cubic meters to Europe, including Turkey, in 2020.

Before Russia can turn on the taps, the pipeline needs technical certification by an organization such as Norwegian risk-management firm DNV stating that it is safe to operate. DNV suspended work on Nord Stream 2 last fall, citing the threat of U.S. sanctions. Nord Stream 2 AG also requires German regulators to approve the company as the system operator, said Katja Yafimava, senior research fellow at the Oxford Institute for Energy Studies.

Gazprom says it could pump 5.6 billion cubic meters of gas via Nord Stream 2 this year, which could still be too little to make up the current shortfall if the winter is cold, analysts said. Europe has 73 billion cubic meters of gas in storage, about 18% below the five-year average for the time of year, according to S&P Global Platts.

James Huckstepp, lead European gas analyst at the commodities-data firm, said much of the gas that flows through Nord Stream 2 this year will be diverted from other pipelines rather than representing additional fuel. He said Gazprom doesn’t have the capacity to produce large extra volumes after a lack of investment in gas fields during a stretch of low prices in recent years.

“The world is running short of gas coming into this winter,” Mr. Huckstepp said.

Rocketing prices in the wholesale gas market are starting to bite consumers and energy-hungry industrial companies. Great Britain’s energy regulator has raised its main cap on retail prices by more than 10%.

Utilities are burning more lignite in place of gas, according to Tom Marzec-Manser, lead European gas analyst at ICIS, which tracks energy and chemical prices. Lignite, also known as brown coal, is cheap but has gone out of favor in recent years because it generates among the highest CO2 emissions of all fossil fuels.

Mr. Marzec-Manser expects westbound gas flows via Poland on the Yamal-Europe pipeline to fall once Nord Stream 2 is working and the European gas market has cooled.

“The market is just very jittery because of this tightness and this lack of flexibility for the winter,” said Natasha Fielding, a gas analyst at Argus Media.

A spokeswoman for the German Ministry for Economic Affairs and Energy said gas storage levels were a matter for the market to decide.

“The security of [gas] supply in Germany remains high,” she said.