BERLIN (AP) — German Chancellor Olaf Scholz ordered ministers Monday to prepare to keep all of the country’s three remaining nuclear plants running until mid-April, putting his foot down on an issue that had threatened to split his three-party government.

The decision comes as Germany tries to prevent a possible energy crunch due to cuts in fuel supplies from Russia over the war in Ukraine.

Scholz’s office said he announced the decision in a letter to the Cabinet, an unusual move reflecting the deep divisions that had riven his junior coalition partners on the issue in recent weeks.

The environmentalist Greens, led by Economy and Energy Minister Robert Habeck, had argued that only two nuclear plants in southern Germany — Isar 2 and Neckarwestheim 2 — should be able to keep operating beyond the scheduled shutdown on Dec. 31 to ease possible power shortages over the winter.

Finance Minister Christian Lindner of the pro-business Free Democrats had suggested all three — including the Emsland reactor in the northwest — should stay online, even beyond April if necessary. Some Free Democrats had even called for three other nuclear plants that were shut down last year to be powered up again in the face of high energy prices and possible blackouts.

Successive German governments have committed to ending the country’s use of nuclear power by the end of the year as part of its transition to safe, renewable energy.

But the war in Ukraine, which has resulted in a sharp cut in natural gas supplies from Russia to Europe, prompted Germany to reactivate old coal and oil-fired power plants. Climate activists such as Sweden’s Greta Thunberg, and others, have argued that it’s a mistake for Germany to switch off its existing nuclear plants if that means burning more planet-heating coal.

Experts say the nuclear power plants are mainly needed to maintain grid stability at times of high electricity demand — including from neighboring France, whose own nuclear reactors have faced a series of problems this year.

In addition to temporarily extending the lifetime of Germany’s nuclear plants, Scholz said his Social Democrat-led government will propose “ambitious” legislation to increase energy efficiency, enshrining in law a plan to end coal use in western Germany by 2030 and building new power plants that can burn hydrogen.