ISTANBUL (AP) — Russia and Ukraine signed separate agreements Friday with Turkey and the United Nations clearing the way for exporting millions of tons of desperately needed Ukrainian grain — as well as Russian grain and fertilizer — ending a wartime standoff that had threatened food security around the globe.

The deal will enable Ukraine — one of the world's key breadbaskets — to export 22 million tons of grain and other agricultural products that have been stuck in Black Sea ports due to Russia's invasion. U.N. Secretary General Antonio Guterres called it “a beacon of hope” for millions of hungry people who have faced huge increases in food costs.

“A deal that allows grain to leave Black Sea ports is nothing short of lifesaving for people across the world who are struggling to feed their families," said Red Cross Director-General Robert Mardini, who noted that over the past six months prices for food staples have risen 187% in Sudan, 86% in Syria, 60% in Yemen and 54% in Ethiopia.

Russian Defense Minister Sergei Shoigu and Ukrainian Infrastructure Minister Oleksandr Kubrakov signed separate, identical deals with Guterres and Turkish Defense Minister Hulusi Akar at a ceremony in Istanbul that was witnessed by Turkish President Recep Tayyip Erdogan.

“Today, there is a beacon on the Black Sea,” Guterres said. “A beacon of hope, a beacon of possibility, a beacon of relief in a world that needs it more than ever.”

“You have overcome obstacles and put aside differences to pave the way for an initiative that will serve the common interests of all,” he told the Russian and Ukrainian envoys.

On Friday, Guterres described the deal as an unprecedented agreement between two parties engaged in a bloody conflict. Erdogan said he hoped the initiative would be “a new turning point that will revive hopes for peace.”

The European Union and Britain immediately welcomed the agreements.

“This is a critical step forward in efforts to overcome the global food insecurity caused by Russia’s aggression against Ukraine,” said EU foreign policy chief Josep Borrell. “Its success will depend on the swift and good faith implementation of today’s agreement.”

British Foreign Secretary Liz Truss said the U.K. applauded Turkey and the U.N. for brokering the agreement.

“We will be watching to ensure Russia’s actions match its words," Truss said. "To enable a lasting return to global security and economic stability, (Russian President Vladimir) Putin must end the war and withdraw from Ukraine.”

Ukraine is one of the world’s largest exporters of wheat, corn and sunflower oil, but Russia’s invasion of the country and naval blockade of its ports have halted shipments. Some Ukrainian grain is being transported through Europe by rail, road and river, but the prices of vital commodities like wheat and barley have soared during the nearly five-month war.

Guterres said the plan known as the Black Sea Initiative opens a path for significant volumes of commercial food exports from three key Ukrainian ports: Odesa, Chernomorsk and Yuzhny.

“It will help stabilize global food prices, which were already at record levels even before the war – a true nightmare for developing countries," Guterres added.

The deal makes provisions for the safe passage of ships through the heavily mined waters. A coordination center will be established in Istanbul, staffed by U.N., Turkish, Russian and Ukrainian officials, to monitor the ships and run the process through specific corridors. Ships would undergo inspections to ensure they are not carrying weapons.

A senior U.N. official said cargo ships would use “safe channels” identified by Ukraine as they sail in and out of ports and would be guided by Ukrainian pilots. The plan does not foresee a further demining of Ukraine's territorial waters, which would have delayed the process.

No military ships would be used as escorts but a minesweeper would be on standby in case the safe channels “need occasional verification,” the official said.

Ships entering the Ukrainian ports would be scrutinized by inspection teams that would include representatives of all parties involved to make sure there are no weapons on board. The unloading of grain onto the vessels will also be monitored.

A key element of the deal is an agreement by both Russia and Ukraine that there will be no attacks on any of the vessels, according to the official.

It will take a few weeks before the deal is fully working, the official noted, saying Ukraine needs about 10 days to get the ports ready and also needs time to “identify and be clear about those safe corridors.”

An initial movement of ships could be possible before then “just to show that they can work,” the official said.

The aim is to export about 5 million tons of grains per month to empty Ukraine's silos in time for the new harvest, according to the U.N. official. The agreement is for a renewable 120-day period.

Guterres first raised the critical need to get Ukraine’s agricultural production and Russia’s grain and fertilizer back into world markets in late April during meetings with Putin in Moscow and Ukrainian President Volodymyr Zelenskyy in Kyiv.

He proposed a package deal in early June amid fears that the war was endangering food supplies for many developing nations and could worsen hunger for up to 181 million people.

Before the deal, Russian and Ukrainian officials blamed each other for the blocked grain shipments. Moscow accused Ukraine of failing to remove sea mines at the ports to allow safe shipping and insisted on its right to check incoming ships for weapons. Ukraine argued that Russia's port blockade and launching of missiles from the Black Sea made any safe shipments impossible.

Ukraine has sought international guarantees that the Kremlin wouldn’t use the safe corridors to attack the key Black Sea port of Odesa. Ukrainian authorities have also accused Russia of stealing grain from eastern Ukraine and deliberately shelling Ukrainian fields to set them on fire.

Volodymyr Sidenko, an expert with the Kyiv-based Razumkov Center think-tank, noted that Ukraine had not raised the issue of grain stolen from the occupied territories in the talks.

“Apparently, it was part of a deal: Kyiv doesn’t raise the issue of stolen grain and Moscow doesn’t insist on checking Ukrainian ships. Kyiv and Moscow were forced to make a deal and compromise on many differences,” he said.

The deal was also important for Russia's geopolitical relations, the analyst noted.

“Russia decided not to fuel a new crisis in Africa and provoke a hunger and government changes there,” Sidenko said. “The African Union asked Putin to quickly ease the crisis with grain supplies and put pressure on the Kremlin, which has its interests in Africa.”

___

Follow AP's coverage of the Russia-Ukraine war at https://apnews.com/hub/russia-ukraine

Copyright 2022 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed without permission.