BUENOS AIRES, Argentina (AP) — Leaders of the world's top economies agreed Saturday to repair the global trading system as they closed a Group of 20 summit that saw the Trump administration at odds with many allies over the Paris accord on climate change and issues like migration.

The joint statement signed by all 20 member nations said 19 of them reaffirmed their commitment to the Paris climate accord, with the United States, which withdrew from the pact under President Donald Trump, the lone holdout. The official communique acknowledged flaws in global commerce and called for reforming the World Trade Organization, but it didn't mention the word "protectionism" after negotiators said that had met resistance from the United States.

Applause broke out in the convention center hall as the leaders, including Trump, signed off on the statement at the end of the two-day summit in the Argentine capital, the first time it has been held in South America.

The non-binding agreement was reached after marathon talks by diplomats stretched overnight and into daylight, amid deep divisions between member nations. European Union officials said the United States was the main holdout on nearly every issue. Trump has criticized the WTO and taken aggressive trade policies targeting China and the EU.

But China also 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, according to the officials.

A senior White House official said the joint statement meets many U.S. objectives and stressed that it includes language about WTO reform. The official also noted other elements such as language on workforce development and women's economic development and a commitment by China to doing infrastructure financing on "transparent terms."

According to the official, the unusual language on climate was necessary for Washington to sign on, and Turkey, Saudi Arabia and Russia had appeared sympathetic to the U.S. position but ultimately stayed with the other countries.

The final language of the statement says, regarding climate, that 19 nations that are signatories to the Paris accord reiterate their commitment to it while the U.S. reiterates its decision to withdraw. It also 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 global commerce, the statement says the 20 countries support multilateral trade but acknowledge that the current system doesn't work and needs fixing, via "the necessary reform of the WTO to improve its functioning."

On migration, European officials said the U.S. negotiator said too much talk about it would have been a "deal-breaker" for Trump. 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.

With trade tensions between the U.S and China dominating the summit, the Europeans sought to play mediator and also scaled back their expectations, cutting out mention of rising protectionism — mainly aimed at Trump.

French President Emmanuel Macron called it a victory that the U.S. signed on to the statement at all, given the tensions going into the talks. "With Trump, we reached an agreement," Macron said. "The U.S. accepted a text."

Thomas Bernes of the Canada-based Centre for International Governance Innovation, who has held leading roles with the International Monetary Fund, the World Bank and the Canadian government, said the G-20 had "veered all over the road" at the summit and failed to truly fix trade. The U.S. was out of step on migration and climate change and blocked meaningful agreement on those issues, he added.

"Instead, leaders buried their differences in obscure language and dropped language to fight protectionism, which had been included in every G-20 communique since the leaders' first summit," he said. "This is clearly a retrograde step forced by United States intransigence."

"The question is whether we are burying the G-20 in the process," Bernes added. "Certainly this is a big hit to the credibility of the G-20 to provide resolute leadership in addressing global problems."

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

The summit statement's language on climate was welcomed by environmental groups such as the World Wildlife Forum and Greenpeace, the latter of which said in a statement: "The necessity of the U.S. being part of the effort to fight climate change cannot be denied, but this is a demonstration that the U.S. is still the odd one out."

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

"Everyone agrees that the WTO should be reformed," German Chancellor Angela Merkel said. "This is an important agreement."

"We will send a clear signal — in any case, most of us" — for the success of global climate talks starting in Poland on Sunday, Merkel added.

Merkel's spokesman said that during a meeting with Russian President Vladimir Putin, she also voiced concern about rising tensions in the Kerch Strait off Crimea and pushed for "freedom of shipping into the Sea of Azov."

Last weekend, Russia seized three Ukrainian naval vessels and their crews in an incident escalating a tug-of-war that began in 2014 when Russia annexed Ukraine's Crimean Peninsula and supported separatist rebels in eastern Ukraine.

Germany and France have sought to mediate between Russia and Ukraine, and Merkel spokesman Steffen Seibert said she and Putin agreed that the four countries should hold further talks at the "adviser level."

Trump and Chinese President Xi Jinping were due to meet later Saturday after the summit's close. Their countries have been embroiled in an escalating trade war with new U.S. tariffs on China goods set to take effect a month from now.

"A fight between two big players does not benefit" world commerce, 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."

In closing remarks, summit host and Argentine President Mauricio Macri said the countries had overcome "a number of challenges."

"We have agreed on a statement that reflects the necessity of revitalizing trade, of revitalizing the WTO. ... "We ratify the concern of everyone over climate change," Macri said.

The next G-20 summit is to be held in Osaka, Japan, in June 2019.

___

Associated Press writers Catherine Lucey and Almudena Calatrava in Buenos Aires and Geir Moulson in Berlin contributed to this report.

Copyright 2018 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.