LVIV, Ukraine — In a thickly forested park bordered by apartment blocks and a playground, a dozen workers were busy on a recent day with chain saws and axes, felling trees, cutting logs and chopping them into firewood to be stashed in concealed sheds around Lviv, the largest city in western Ukraine.

Nearby ironworkers are working overtime to produce wood-burning stoves to be stored in strategic locations.

In municipal depots, room is being made to stockpile reserves of coal.

The activity in Lviv is being played out in towns and cities across Ukraine, part of a nationwide effort to amass emergency arsenals of backup fuel and critical provisions as Russia tightens its chokehold on energy supplies across Europe.

As President Vladimir Putin slashes natural gas flows to Ukraine’s European allies, the government in Kyiv has accused Russia of also stepping up the destruction of critical infrastructure that provides heat, water and electricity to millions of homes, businesses and factories.

“All cities are preparing for a hard winter,” said Andriy Sadovyi, the mayor of Lviv, where Russian rockets knocked out three electrical substations in April, temporarily cutting power to neighborhoods. “Russia has turned off the gas to our neighbors, and they are trying to pressure us too,” he said. “Our goal is survival. We need to be ready.”

The urgency escalated after Russia again curtailed gas supplies to Europe last week, leading the European Union to announce it will reduce imports of Russian gas.

Russia turned off the gas taps to Latvia on Saturday, after the government there announced additional military assistance for Ukraine, the latest in a string of European countries to do so.

Ukraine buys its natural gas from European neighbors, so the restriction of deliveries to Europe threatens its access to energy too.

Ukrainians frequently say they hope to defeat Russia by the time the cold weather arrives in October.

But the leadership is also girding for the possibility of a drawn-out conflict in which Russia turns up the pressure by methodically strangling Ukrainians’ ability to keep warm.

“We understand that the Russians may continue targeting critical energy infrastructure before and during the winter,” said Oleksiy Chernyshov, Ukraine’s minister for communities and territories development.

“They’ve demolished central heating stations in big cities, and physical devastation is still happening nationwide,” he said. “We are working to repair damage, but it doesn’t mean we won’t have more.”

Far from Ukraine’s embattled southeastern front, the campaign is being waged in forests and forges, at gas storage sites and electrical stations, and even in basement boiler rooms, as the government mobilizes regions to activate a blueprint for amassing fuel and shelter.

Hundreds of thousands of cubic yards of firewood is being cut in forests around the country, Yuriy Bolokhovets, the head of Ukraine’s forest agency, said in a statement.

Under the government’s plan, so-called mobile heating units would be set up in cities of up to 200,000 people where shelling has cut heat or electricity, to help residents cope with outages until damaged infrastructure can be fixed.

In an unlikely twist, the war has left Ukraine with an electricity surplus after millions of people fled the country and economic activity slowed.