Ukraine and Russia have signed a landmark deal aimed at relieving a global food crisis caused by blocked Black Sea grain deliveries, ending months of negotiations and sending wheat prices tumbling to levels last seen before Moscow's invasion.
The first major deal between the warring parties since the February invasion of Ukraine should help ease the "acute hunger" that the United Nations says faces an additional 47 million people because of the war.
The hostility between Moscow and Kyiv spilled over into the signing ceremony -- delayed briefly by disputes about the display of flags around the table and Ukraine's refusal to put its name on the same document as the Russians.
The two sides eventually inked separate but identical agreements in the presence of U.N. Secretary General Antonio Guterres and Turkish President Recep Tayyip Erdogan at Istanbul's lavish Dolmabahce Palace.
"Today, there is a beacon on the Black Sea -- a beacon of hope, a beacon of possibility, a beacon of relief," Guterres said moments before the signing.
Erdogan -- a key player in the negotiations who has good relations with both Moscow and Kyiv -- said the deal would "hopefully revive the path to peace."
But Ukraine entered the ceremony by bluntly warning that it would conduct "an immediate military response" should Russia violate the agreement and attack its ships or stage an incursion around its ports.
Ukrainian President Volodymyr Zelensky later said the responsibility for enforcing the deal would fall to the U.N., which along with Turkey is a co-guarantor of the agreement.
- 20 million tons of wheat -
The agreement includes points on running Ukrainian grain ships along safe corridors that avoid known mines in the Black Sea.
Huge quantities of wheat and other grain have been blocked in Ukrainian ports by Russian warships and landmines Kyiv has laid to avert a feared amphibious assault.
Zelensky said that around 20 million tons of produce from last year's harvest and the current crop would be exported under the agreement, estimating the value of Ukraine's grain stocks at around $10 billion.
Following the deal, wheat prices tumbled to levels last seen before Russia's invasion -- even as some analysts expressed skepticism about the accord.
In Chicago, the price of wheat for delivery in September dropped 5.9 percent to $7.59 per bushel, equivalent to about 27 kilograms. Prices in Europe fell by a similar amount.
Russian Defense Minister Sergei Shoigu told Kremlin state media after attending the signing ceremony that he expected the deal to start working "in the next few days."
He pointed out that Russia had managed to secure a separate pledge from Washington and Brussels to lift all restrictions on its own grain and other agricultural exports.
The United States and European countries hailed the agreement while urging Moscow to abide by its rules.
A U.S. official said the deal was "well-structured" enough to monitor Russian compliance.
The European Union called for the deal's "swift implementation" while British Foreign Secretary Liz Truss said London "will be watching to ensure Russia's actions match its words".
- Guarded hope -
Diplomats expect grain to only start fully flowing by mid-August.
The four sides must first set up a joint command and control center in Istanbul that monitors the ships' passage and addresses disputes.
They have yet to finalize how the ships will be checked for weapons before returning empty to Ukrainian ports.
Ukrainian farmers who have been watching their silos fill up with grain that they cannot sell met the Istanbul deal with guarded hope.
"It gives some hope but you can't believe what the Russians say," said farmer Mykola Zaverukha.
His silos were already filled with 13,000 tons of grain and in danger of overflowing because this year's harvest was beginning to come in.
"Russia is unreliable, they have shown themselves to be year after year," he told AFP in the southern Mykolaiv region.
Global alarm about that grain has been accompanied by European fears that Russia is starting to use its stranglehold on energy exports as a geopolitical weapon in its standoff with the West.
The grain deal was signed one day after Russia's restart of the Nord Stream natural gas pipeline eased concerns in Europe of a permanent shut off after a 10-day maintenance suspension.
Analysts say that the partial resumption of gas supplies was insufficient to ward off energy shortages in Europe this winter.
- More U.S. military aid -
The ornate halls of Istanbul's Dolmabahce Palace felt far removed from east Ukraine's Donbas war zone on another day of relentless shelling across the front.
Russia is trying to fight deeper into the war zone's Donetsk region after securing full control of neighboring Lugansk.
On Friday, the United States signed off on another $270 million in military aid to Ukraine, including rocket systems, artillery ammunition and armored command posts.
The Ukrainian presidency said five people were killed and 10 wounded in Russian attacks around the Donetsk region the previous day.
In the Donetsk village of Chasiv Yar -- hit by a strike on July 10 that killed more than 45 people -- 64-year-old Lyudmila was gathering apricots near the wreckage.
"There is nothing anymore. The officials have left. We have to fend for ourselves to stay alive," she said, giving only her first name.
The military toll on both sides has remained speculative since Russia invaded on February 24.
U.S. and British spy chiefs believe Russian President Vladimir Putin was suffering greater losses than expected.
Ukraine's war effort has been particularly helped in recent weeks by the delivery of US high-precision weapons that allow Kyiv to destroy Russian weapons silos at long range.