Germany agreed to provide a 17 billion-euro ($17.3 billion) rescue package for struggling utility Uniper SE in its biggest move to date to prevent the collapse of its energy network in the wake of Russia’s moves to slash gas deliveries.

While consumers will soon start to bear the cost of the fallout of lost supply, Chancellor Olaf Scholz vowed to contain the impact of the energy crunch on the wider economy as the country prepares for potential gas rationing in the coming months.

“We will do all that is necessary to ensure that together we will succeed and we will continue to do so for as long as it takes,” Scholz said in Berlin, interrupting his vacation to announce the bailout. “We will overcome the difficult times together.”

Uniper became the first major corporate casualty of Europe’s unfolding gas crisis when it asked for a government bailout earlier this month. Germany’s biggest buyer of Russian gas was pushed to the brink as President Vladimir Putin squeezed supplies in retaliation over European sanctions against Russia’s invasion of Ukraine.

Decades of increasing reliance on cheap energy from Russia made Germany vulnerable to pressure from Moscow. German authorities have warned consumers to brace for energy bills to double or triple in the coming months, deepening the pain from surging cost-of-living increases.

“I’m pleased and relieved that today’s agreement stabilizes Uniper financially as a system-critical energy partner,” Chief Executive Officer Klaus-Dieter Maubach said. “We now have a clear perspective on how the costs, which arise due to the interrupted gas supplies from Russia can be shared by many shoulders.”

Scholz said a new package of aid measures would be put in place by early next year to ease the burden on households, as the government effectively shores up the entire energy sector.

Highlights of Germany’s Uniper deal:

  • A capital increase of 267 million euros, giving the government a 30 percent stake
  • Increasing a credit line with state-run lender KfW to 9 billion euros
  • Mandatory convertible securities of 7.7 billion euros
  • A right to pass on 90 perce t of higher costs from Oct. 1
    • Measures subject to:
    • Withdrawal of Uniper’s lawsuit against the Netherlands for the country’s coal exit
    • Regulatory and shareholder approvals
    • Confirmation of Uniper’s investment grade rating by S&P Global Ratings

Uniper — set up in 2016 from E.ON SE’s former fossil-fuel assets — emerged as the weakest link in the energy system that powers Europe’s largest economy. Its extensive contracts with Russia’s Gazprom PJSC made the utility particularly exposed to supply cuts and forced it to cover shortfalls at high prices on the spot market.

As part of the bailout, Uniper can pass on 90 percent of the additional costs for replacing missing Gazprom supplies and it said the government would cover the losses on gas sold in Germany.

After the transaction closes, the government will control about 30 percent of Uniper, a holding big enough to give it veto rights on important strategic decisions. The total bailout package is worth more than four times the company’s current market value, and it could just be the beginning.

“Whilst we have now achieved immediate stabilization of Uniper, further efforts will be required to create a long-term sustainable basis for the gas business,” said Fortum CEO Markus Rauramo. The Finnish utility agreed to see its stake diluted to 56 percent from 78 percent.

As it burned through cash, Uniper had already drawn a 2 billion-euro credit line from KfW and started talks about additional funds after getting 8 billion euros in financing earlier this year from Fortum.

Despite the financial risk, Germany couldn’t afford to let Uniper fail as the fallout would ripple through the economy, hitting industrial companies and local utilities. While flows on a key gas link with Russia have resumed after 10-day maintenance, deliveries remain significantly reduced and storage levels are low.

On Thursday, Germany raised its targets for gas reserves, reflecting growing concern about having enough energy to heat homes and keep factories running through the winter. The move increases the likelihood that the government will intervene in managing supplies.

Germany’s gas storage stands at about 65 percent. To reach the 95 percent level targeted for Nov. 1, the country would need nearly three months at the average fill rates in the week before the Nord Stream pipeline was halted. Scholz indicated that he isn’t relying on Russia to hold to its delivery commitments.

The energy squeeze has been gradually becoming more tangible in Germany. Heating pools is banned, Cologne is dimming street lights and Hamburg plans to make warm water only available at certain times of the day. Some cities are setting up heating halls to help people escape the cold.

“In this crisis, the state must do everything possible to prevent the system from collapsing,” said Michael Vassiliadis, head of the IGBCE union, acknowledging that higher energy bills needed to be part of the package. “Waste needs to be combated through price.”