People walk in front of an apartment building that was hit by missiles several months earlier, in Kyiv, Ukraine, on September 4. Germany, Sweden and the Czech Republic announced measures to populations feeling the bite of rising inflation and energy costs tied to war in Ukraine. [Brendan Hoffman/The New York Times]

BERLIN – European governments moved this weekend to soften the blow of soaring costs and a deepening energy crisis triggered by the war in Ukraine, and scrambled to prepare for the possibility of social unrest as the days grow colder.

With Europe trying to wean itself off Russian fossil fuels, and the first mass protests over energy costs appearing on the continent, governments are racing to adopt stopgap measures before fall and winter. Energy ministers of the European Union have planned an emergency meeting this week, and three countries announced relief measures Sunday.

The biggest package came from Germany, where Chancellor Olaf Scholz’s government pledged $65 billion in relief measures to cushion the blow of inflation and the energy crisis, which worsened after Russia’s invasion of Ukraine and Western governments’ imposition of harsh sanctions on Moscow in response. Europe is now working to drastically reduce its purchases of Russian oil and gas.

Berlin announced its package two days after Gazprom, the Kremlin-controlled Russian energy giant, announced an indefinite halt to the flow of gas through the Nord Stream 1 pipeline that terminates in Germany and provides gas to much of Europe. Gazprom said the pipeline would remain closed until problems found during inspections were resolved, but offered no timeline.

European officials say the move is politically motivated. It came Friday, the same day that finance ministers for the Group of 7 countries agreed to impose a price cap on Russian oil in an effort to cut off some of the energy revenue Moscow continues to earn from Europe.

“Russia is no longer a reliable energy supplier – that is part of the new reality,” Scholz said in his speech announcing the package Sunday. “We are all feeling the consequences of the Russian war.”

Economic anxiety is palpable across Europe.

In Prague, a day after the government survived a no-confidence vote over accusations that it had failed to act on soaring prices, tens of thousands of protesters took to the streets Saturday to voice outrage over energy costs.

In Stockholm, the Swedish government said it would offer $23 billion in liquidity to help energy companies with supply purchases until March.

And France has begun its biggest conservation effort since the 1970s oil crisis, with French President Emmanuel Macron calling for an era of energy “sobriety.” The government has spent more than $26 billion to defray the cost of rising household energy bills.

This article originally appeared in The New York Times.