BUENOS AIRES, Argentina (AP) — All-night talks at the Group of 20 summit led to a possible "breakthrough" on fixing the global trading system, European diplomats said Saturday, as negotiations stretched into the final hours of the gathering's crucial second and final day in the Argentine capital.

Despite deep divisions going into the summit and resistance from the United States, European Union officials were optimistic and said countries were making progress on a final statement that will acknowledge problems with the World Trade Organization but commit to reforming it.

The U.S. was the main holdout on nearly every issue, the officials said. President Trump has criticized the WTO and taken aggressive trade policies targeting China and the EU.

But China pushed back in talks on steel, South Africa objected to language on trade , Australia didn't want the statement to be too soft on migration and Turkey worried it would push too far on climate change.

With trade tensions between the U.S and China dominating the summit, the Europeans sought to play mediator.

They also scaled back their expectations, cutting out mention of rising protectionism — mainly aimed at Trump — and agreeing to language on climate that says 19 leaders support the Paris climate accord and international efforts to reduce emissions, but the U.S. doesn't.

The six-page draft statement says the 20 countries support the international trading system but acknowledge that the current system doesn't work and needs fixing, via reform of the WTO. The European diplomats called this the "main breakthrough."

On climate, the statement notes a recent U.N. report that warned damage from global warming will be much worse than previously feared, and expresses support for an upcoming U.N. climate meeting in Poland meant to nail down how countries will meet promises made in the Paris accord.

On migration, the U.S. negotiator said too much talk about migration would have been a "deal-breaker" for Trump, the European officials said. So they came up with "minimalist" language that acknowledges growing migrant flows and the importance of shared efforts to support refugees and solve the problems that drive them to flee.

The statement also shows a commitment to a "rules-based international order," despite Trump's rejection of many of those rules.

"There were moments when we thought all was lost," one European official said, "moments when we spent two hours on one sentence."

The officials spoke on condition of anonymity to discuss the ongoing closed-door discussions.

Perhaps surprisingly, one country that was seen as particularly constructive was Russia, the officials said. Despite tensions over its military actions on Ukraine and political interference abroad, Russia supports international efforts on trade and climate.

While a statement isn't legally binding, the Europeans see it as proof that the G-20 is still relevant and that multilateralism still works.

Saturday will also see a highly anticipated meeting between Trump and Chinese President Xi Jinping, whose nations have been embroiled in an escalating trade war with new U.S. tariffs on China goods set to take effect a month from now.

"The trade war between the United States and China does not favor international commerce. ... A fight between two big players does not benefit," said Dante Sica, Argentina's minister of production and labor. "If they are able to begin to agree, it would be a good signal that would reduce the impacts on international commerce."

The divisions among the world's leading economies were evident from the moment Argentina's president opened the summit Friday with a call for international cooperation to solve the planet's problems.

On Friday, a U.S. official said progress was being made on the joint statement and the White House was "optimistic" about the document as a whole.