The world’s largest oil producers were closing in on a deal to rescue crude markets from a coronavirus-induced collapse after U.S. President Donald Trump stepped in to broker a truce. An unprecedented cut of about 10% in worldwide crude production — which seemed unlikely last week when Trump first floated the idea in a tweet — was all but certain on Friday, with Mexico the last holdout. Now, a compromise backed by Trump will be discussed between the Latin American country and Saudi Arabia on Saturday. Russia has already said it considers the plan a done deal.

The survival of thousands of crude producers, millions of jobs and the economies of oil-dependent nations are hanging in the balance as the global pandemic wipes out demand in a world awash with crude. Several U.S. shale producers are on the brink of bankruptcy, Russia risks having no place to store its crude, and for all their low-cost production, the Saudis need higher prices to fund the kingdom’s budget. The Group of 20 nations, after an online meeting Friday, said it would take “all the necessary measures” to maintain a balance between oil producers and consumers, but it made no commitment toward specific steps on production cuts.

Members of the Organization of Petroleum Exporting Countries, and allied producers led by Russia, have since 2017 been part of a coalition known as OPEC+ to voluntarily curb output and keep the market in balance. That alliance began to crumble last month, when Saudi Arabia and Russia couldn’t reach an agreement on further cuts. The U.S., now the world’s largest oil producer, is not part of that coalition but has participated in recent talks given the unprecedented situation for the global economy.

After Trump held calls with Russia’s Vladimir Putin and Saudi King Salman Bin Abdulaziz in recent days, the two rivals were ready for a deal at an OPEC+ virtual meeting on Thursday, followed by the G-20 video conference Friday. That meant getting past their grudge over Trump’s stance that America’s contribution would be in the form of cuts that have already started to happen naturally over time as explorers adjust to the crisis. Then Mexico threw a spanner in the whole process.

Mexico’s Energy Minister Rocio Nahle didn’t budge from her insistence that the country could only cut output by 100,000 barrels a day, 300,000 less than its fair share of 23% reductions by everyone in the OPEC+ group.

On Friday morning, Mexican President Andres Manuel Lopez Obrador said he had resolved the matter in a phone call with Trump. The U.S. would make an additional 250,000 barrels a day of cuts on Mexico’s behalf.

Trump said he had agreed to “help Mexico along” in making a deal with Russia and Saudi Arabia. The U.S. will make up the difference, he said Friday after a call with Lopez Obrador on Thursday. He suggested output cuts American producers have only started making to weather the price crash could be counted toward Mexico’s share of the pact.“We are trying to get Mexico, as the expression goes, over the barrel,” Trump said in a White House news conference on Friday.

The shale boom that turned the U.S. into the world’s largest oil producer is unraveling fast. Last week, the country’s production fell by 600,000 barrels a day from a near-record 13 million as shale explorers idle rigs in the Permian Basin of West Texas and elsewhere in the country. That’s almost the equivalent of wiping out Venezuela’s current output.

Energy Secretary Dan Brouillette, in opening remarks at the G-20 meeting, said he predicted a decline of nearly 2 million barrels a day in U.S. output by the end of this year. Russia appeared satisfied with the unusual math to include part of that as Mexico’s contribution. Kremlin spokesman Dmitry Peskov told reporters in Moscow that Putin considers the OPEC+ deal to be fully agreed and regards it “very positively.”