MUENSTER  - The Group of Seven countries agreed on Friday to coordinate their support for the reconstruction of Ukraine's energy and water supplies following recent Russian attacks on the power grid that have caused widespread blackouts.

"We will stand firmly with Ukraine for as long as it takes," the foreign ministers of the wealthiest democracies said after a two-day meeting in the western German town of Muenster.

"Today we establish a G7 coordination mechanism to help Ukraine repair, restore and defend its critical energy and water infrastructure," their statement said.

Russia's Feb. 24 invasion of Ukraine, Iran's deepening military alignment with Moscow over the war as well as China's growing assertiveness topped the agenda of the G7 meeting.

The coordinating mechanism would be the core focus of the group in the days and weeks ahead, a senior U.S. State Department official told reporters on condition of anonymity.

Over the past few weeks, Russia has launched waves of missile and drone strikes targeting Ukraine's energy infrastructure. Kyiv says they have damaged up to 40% of the power system and Ukrainian authorities warned that residents may face hours of blackouts due to the limited supplies.

The assistance that will allow Kyiv to defend itself against and respond to Russian attacks on civilian infrastructure included air defence systems, the U.S. official said.

"There was a decent amount of discussion of that, and what countries have the ability to provide the individual systems and support that might enable Ukraine to better defend itself against these UAV and missile attacks," the official added.

Ukrainian Foreign Minister Dmytro Kuleba joined the G7 discussion virtually.

Moscow has acknowledged targeting energy infrastructure but denies targeting civilians in what it calls a "special military operation" in Ukraine to eliminate dangerous nationalists and protect Russian-speakers.

Ukraine and its Western allies have accused Iran of sending "kamikaze" drones, or unmanned aerial vehicles (UAVs), to Russia which have then been used to devastating effect by Russian forces in strikes targeting Ukrainian infrastructure as part of their Feb. 24 invasion of Ukraine. Iran denies the charge.

NATO has pledged to boost the protection of critical infrastructure after the ruptures in September in the Nord Stream 1 and Nord Stream 2 gas pipelines, laid on the bed of the Baltic Sea from Russia to Germany.

(Reporting by Humeyra Pamuk, Sabine Siebold and Sarah Marsh; Editing by Alex Richardson and Philippa Fletcher)