The United Nations, Turkey, Russia, and Ukraine signed four-way deal in Istanbul Friday intended to deliver Ukrainian grain to world markets.

The deal is the result of months of negotiations as world food prices soar amid increasing grain shortages connected to Russia’s invasion of Ukraine.

U.N. Secretary-General Antonio Guterres heralded the agreement as a major diplomatic breakthrough.

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

Guterres praised Turkey’s role in securing the agreement. Turkish President Recep Tayyip Erdogan said the deal offers the opportunity to ease the threat of global hunger and give hope for a resolution to the ongoing conflict in Ukraine.

Under the agreement, cargo ships will carry grain from three Ukrainian ports, including Odesa. Using safe channels, Ukrainian pilots will guide the vessels through the heavily mined waters. The ships will then traverse the Black Sea in specially created corridors to Istanbul’s Bosphorus waterway and on to world markets.

All cargo ships will be checked by a Joint Coordination Center set up in Istanbul to ensure they are not carrying weapons into Ukraine. Ukrainian, Russian, U.N., and Turkish officials will staff the center.

Moscow has promised not to launch hostilities in the vicinity of cargo ship routes and the port areas involved in grain exports.

The U.N. said the agreement could take weeks to take effect but aims to export around 5 million tons of grain a month. 

The deal was reached as world food prices soared due to grain shortages. Ukraine is one of the world’s biggest suppliers of grain. Earlier this week, U.N. food chief David Beasley said Ukrainian grain shipments couldn’t come soon enough.

“[It’s] Essential that we allow these ports to open because this is not just about Ukraine,” he said. “This is about the poorest of the poor around the world who are on the brink of starvation.”

Ankara has been hosting and mediating the four-way talks. Turkey, a NATO member, has sought to play a balancing role in the conflict, with President Erdogan maintaining close ties with his Ukrainian and Russian counterparts. 

Sinan Ulgen of the Center for Economics and Foreign Policy Studies, a research organization in Istanbul, says the successful grain deal will vindicate Erdogan’s stance.

“I think Turkey’s careful balancing act will continue and there may even be a degree of appreciation in the West for the diplomatic role of Turkey in particular if Turkey is able to deliver on the food embargo quest,” Ulgensaid.

Under the grain deal, Turkey is set to continue playing a pivotal role in its application. The agreement will need to be renewed on a 120-day basis, meaning Turkish diplomacy will likely be critical to its continuation.