Europe faced the prospect of a radiation disaster on Thursday when a Russian-occupied nuclear plant was disconnected from Ukraine's power grid, President Volodomyr Zelensky has said.
It was only due to back-up electricity kicking in that the Zaporizhzhia plant was able to operate safely, he added.
Fires had earlier damaged overhead power lines, cutting the plant off.
There is growing concern over fighting near the complex, which is the largest nuclear plant in Europe.
"If the diesel generators hadn't turned on, if the automation and our staff of the plant had not reacted after the blackout, then we would already be forced to overcome the consequences of the radiation accident," President Zelensky warned on Thursday night.
The damage was caused by fires which Ukraine's state nuclear agency said had interfered with power lines connecting the plant on Thursday, temporarily cutting Zaporizhzhia off from the national grid for the first time in its history.
"As a result, the station's two working power units were disconnected from the network," Kyiv officials said.
Satellite images taken on Wednesday showed an extensive fire burning in the immediate vicinity of the nuclear complex.
President Zelensky blamed the damage on Russian shelling, and in his nightly address accused Moscow of putting Ukraine and Europe "one step away" from disaster.
But local Russian-appointed governor Yevgeny Balitsky blamed the Ukrainian military for the strikes, accusing them of causing power outages to the region as a result.
The BBC was not able to independently verify who was responsible.
Radiation levels nearby remained normal despite the Zaporizhzhia nuclear complex losing its main power supply on Thursday, local officials reported.
The UN's nuclear watchdog, the International Atomic Energy Agency (IAEA), said the plant "remained connected to a 330kV line from the nearby thermal power facility that can provide back-up electricity if needed", citing Ukraine's state nuclear agency.
It added that all six nuclear reactor units remained disconnected from the power grid despite supplies having been restored later on Thursday.
Normally the nuclear plant supplies one-fifth of Ukraine's total electricity - so its continued disconnection from the national grid would pose serious challenges for Ukraine.
The nuclear site has been occupied by Russian military forces since early March but continues to be operated by Ukrainian nuclear technicians.
The Kremlin has signalled it will allow international inspectors to visit the complex - but until that happens it is difficult to verify what is happening on the ground.
"Almost every day there is a new incident at or near the Zaporizhzhia nuclear power plant. We can't afford to lose any more time," IAEA director general Rafael Grossi said in a statement, repeating his call to lead an international mission to the plant in the next few days.
Energy experts worry that some of the site's safety mechanisms could fail if the complex loses all power.
It comes amid claims from Kyiv that Moscow could be trying to intentionally divert power from the occupied nuclear plant to reconnect it to Russia's own power grid.
There were media reports on Thursday of power outages across towns and villages in neighboring parts of Russian-occupied Ukraine.
The mayor of Enerhodar, which is located next to the nuclear plant, claimed on Thursday that the city had no power or water at all and there were also reports of power cuts in the Russian-occupied cities of Melitopol and Kherson.
Washington officials condemned any bid by Moscow to redirect the power generated by the Zaporizhzhia plant away from Kyiv's national grid.
"The electricity that it produces rightly belongs to Ukraine," US state department spokesperson Vedant Patel said on Thursday evening, adding that "no country should turn a nuclear power plant into an active war zone."