Talks aimed at resuming Ukrainian grain exports blocked by Russia in the Black Sea have produced a deal, Turkey said.
It raises hopes for an end to the standoff, which left millions at increased risk of starvation.
Turkey’s defence minister, Hulusi Akar, said both sides had agreed on ways to ensure the safety of shipping routes for grain ships.
He said the agreement would be signed next week, when more talks are set to be held in Turkey.
UN Secretary-General António Guterres called Wednesday’s progress a “critical step forward”.
He said more work was needed to finalise the deal, which would require “a lot of goodwill and commitments by all parties”.
Ukraine has been able to send some of its grain by road and rail, and a new naval route is opening up through the Danube estuary. But only 2.5 million tonnes were exported last month, much less than the eight million-tonne average before the war, and millions more are waiting in the Ukrainian port of Odesa.
Russia’s Black Sea fleet is said to be stopping any shipments getting in or out, and the BBC has documented mounting evidence that Moscow’s forces have stolen and exported Ukrainian grain. Other routes have been heavily mined.
But speaking from Kyiv during his nightly address on Wednesday, Ukrainian President Volodymyr Zelensky appeared to strike an optimistic tone.
“The Ukrainian delegation has reported to me that there is progress. In the coming days, we will agree on the details with the UN secretary-general,” he said.
Before progress was announced, diplomats said negotiations included plans for Ukrainian vessels to guide grain ships in and out of mined port waters.
It was also suggested that Russia would be urged to respect a truce while shipments move and that Turkey – supported by the UN – would offer to inspect ships to allay Russian fears of weapons smuggling.
Russia and Ukraine produce 30% of the world’s wheat supply. Before the war, Ukraine was seen as the world’s bread basket, exporting 4.5 million tonnes of agricultural produce a month through its ports.
And while Ukraine has managed to get some exports through other channels, they have only partly compensated for the closure of the Black Sea, with export volumes down to about 30% of their pre-war totals.
In May, Mr Guterres warned that the Russian blockade threatened “to tip tens of millions of people over the edge into food insecurity followed by malnutrition, mass hunger and famine”.
“There is enough food in our world now if we act together. But unless we solve this problem today, we face the spectre of global food shortage in the coming months,” he added.
And in June, UK Prime Minister Boris Johnson accused Russian President Vladimir Putin of seeking to hold the world to “ransom” with the blockade.
“It is absolutely unconscionable,” he said. “That supply could help people around the world, it could help some of the poorest countries in the world.”
Despite the news of progress in grain talks, Russian shelling of several major Ukrainian cities has renewed overnight.
In the eastern Donetsk Oblast, Ukrainian officials said there had been sustained Russian shelling across the province, which Moscow aims to capture to complete its seizure of the industrialised Donbas region of eastern Ukraine.
Last month, Russian Defence Minister Sergei Shoigu reported to Mr Putin that his forces had completed the first stage of that plan by capturing Luhansk province.
Meanwhile, near the southern city of Kherson. Russian state media reported that Ukrainian forces have renewed their offensive in the region by firing several missiles at the city of Nova Khakova.
Kherson was the first major city to fall to Russia in the early stages of the invasion. In recent weeks, Kyiv’s forces have been slowly advancing on its outskirts.