Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

BUENOS AIRES, Argentina — Leaders of the Group of 20 agreed Saturday to fix the world trading system after difficult, all-night talks in the Argentine capital, but only 19 of them agreed to support the Paris accord on fighting climate change with the United States the lone holdout.

The official summit statement acknowledges flaws in global commerce and calls for reforming the World Trade Organization. It doesn't mention the word "protectionism," however, after negotiators said that had met resistance from the United States.

Applause broke out in the summit hall as the leaders, including U.S. President Donald Trump, signed off on a final statement at the end of a two-day summit.

The non-binding agreement was reached after talks by diplomats stretched overnight and into daylight on Saturday, 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 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.

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.

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.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

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.

"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 closed-door negotiations.

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.

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.

"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."

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.