The process required the collaboration of the two warring nations, along with Turkey and the United Nations.
There were many moving parts to the deal allowing for the export of grain from Ukrainian ports that Russia said on Saturday it was suspending indefinitely.

Here’s what to know about the grain problem, and how the deal addressed it.

Why was Ukrainian grain stuck inside the country?
After Russia invaded Ukraine on Feb. 24, it deployed warships along Ukraine’s Black Sea coast. Ukraine mined those waters to deter a Russian naval attack. That meant that the ports used to export Ukrainian grain were blocked for commercial shipping. Russia also pilfered grain stocks, mined grain fields so that they couldn’t be harvested and destroyed grain storage facilities.
How did the operation work?
Ukrainian captains steered vessels packed with grain out of the ports of Odesa, Yuzhne and Chornomorsk.

A joint command center with officials from Ukraine, Russia, Turkey and the United Nations was set up in Istanbul to monitor every movement of the flotillas.
The ships headed into Turkish waters, to be inspected by a joint team of Turkish, U.N., Ukrainian and Russian officials, then delivered their cargo to destinations around the world, returning for another inspection by the joint team before heading back to Ukraine.

The agreement specified that the inspection team’s primary responsibility was to check for “unauthorized cargoes and personnel on board vessels inbound to or outbound from the Ukrainian ports.” A key Russian demand was that the returning ships were not carrying weapons to Ukraine.

The parties agreed that the vessels and the port facilities used for their operations would be safeguarded from hostilities.

The agreement was meant to be valid for 120 days — expiring on Nov. 19. The United Nations said that, as of this week, it had allowed for the export of more than 9 million tons of grain and other foodstuffs. More than least 790 cargo voyages — 395 inbound and 399 outbound — have been cleared, according to U.N. data.
What was in it for Russia?
Russia is also a major exporter of grains and fertilizer, and the agreement made it easier to sell those goods on the world market.

The Kremlin has repeatedly claimed that its stocks cannot be exported because of sanctions imposed by the United States and the European Union.

The measures did not in fact affect those goods, but private shipping companies, insurers, banks and other businesses have been reluctant to help Russia export grains and fertilizers, fearing that they might run afoul of sanctions or that doing business with Russia might harm their reputations.

Offering reassurance, the European Union on July 21 issued a legal clarification to its sanctions, saying that various banks and other companies involved in the grain trade were not in fact banned.

But in recent weeks, Russia suggested it might refuse to extend the agreement if Moscow’s demands over its food and fertilizer exports were not met.

What happens now?
Russia said it was suspending participation in the grain deal for an indefinite period. The United Nations said it was in touch with Moscow and urged exports to continue.

“It is vital that all parties refrain from any action that would imperil the Black Sea Grain Initiative, which is a critical humanitarian effort that is clearly having a positive impact,” Stéphane Dujarric, the spokesman for the United Nations secretary general, said.