World powers lined up against U.S. President Donald Trump on climate change, reaffirming their support for international efforts to fight global warming.

The Group of 20 summit that ended Saturday in Hamburg also revealed tensions on trade, as the U.S. administration and international partners forged a deal that endorsed open markets but acknowledged countries had a right to put up barriers to block unfair practices

The summit's final statement made clear that the other countries and the European Union unanimously supported the Paris climate agreement rejected by Trump. They called the deal to reduce greenhouse gases "irreversible" and vowed to implement it "swiftly" and without exception.

The other countries, from European powers such as Germany to emerging ones such as China and energy producers such as Saudi Arabia, merely "took note" of the U.S. position, which was boxed off in a separate paragraph that the summit host, German Chancellor Angela Merkel, made clear applied only to the United States.

She said the U.S. position was "regrettable" but that the summit had achieved "good results in some areas," and cited a hard-won agreement on trade that included Trump and the United States but did not erase the differences over the issue. She said the talks had been at times "difficult."

Trump's chief economic adviser played down tensions between the U.S. and other nations as the president headed home from his first G-20 summit.

Gary Cohn told reporters aboard Air Force One that while communiques "are never easy," he thought this one "came together pretty reasonably. He said having "a diversity of opinions in a group of 20" was not unexpected.

"To get 20 of your friends to agree to have dinner tonight is pretty hard," Cohn said.

Cohn added that while the U.S. obviously has chosen to get out of the Paris agreement, "we do go out of our way to say in there that that doesn't mean we don't support the environment and we're still working for the environment."

On trade, the talks preserved the G-20's condemnation of protectionism, a statement that has been a hallmark of the group's efforts to combat the global financial crisis and the aftereffects of the Great Recession.

The group added new elements, however: an acknowledgment that trade must be "reciprocal and mutually advantageous" and that countries could use "legitimate trade defense instruments" if they are being taken advantage of.

U.S. Treasury Secretary Steven Mnuchin said there was "incredible consensus" on the issue and that the U.S. pushed to include the phrasing about "reciprocal" trade.

The wording echoes concerns voiced by Trump, who has said trade must be fair as well as open and must benefit American companies and workers. He has focused on trade relationships where other countries run large surpluses with the U.S., meaning they sell more to U.S. consumers than they buy from American companies.

That's in contrast to the approach favored by Merkel and the EU, who stress multilateral trade frameworks such as the World Trade Organization.

More broadly, concerns about trade and its impact on workers figured large in the 2016 U.S. presidential election and in Britain's referendum vote to leave the European Union, a free-trade bloc.

Yet pro-trade officials from the European Union pointed out that the language in the G-20 statement contains no departure from the current global system of regulation, which already allows countries to take defensive measures within the rules of the WTO. Those can include import taxes that offset unfair practices such as government subsidies or below-cost pricing.

Despite the trade agreement, the summit was marked by clashing visions, especially where Washington and the European Union were concerned.

The EU demonstrated its willingness to move ahead with free trade despite Trump by announcing a trade agreement with Japan on the eve of the summit.

On climate, summit deputies worked until shortly before the ending news conferences to hash out a three-part fudge that everyone could sign. That meant a first section with a broad pledge to fight climate change in general; a separate paragraph carved out that acknowledged the U.S. did not support the Paris deal; and a third paragraph in which the other 19 members reaffirmed their support for the deal.

Advocates for efforts against global warming expressed relief that the other countries had remained unanimous in support of the Paris accords.

"The U.S. has obviously been clear about where it stands with the Paris Agreement, but it is heartening that 19 other countries reaffirmed their commitment to the agreement," said Thoriq Ibrahim, minister of energy and environment for the Maldives and Chair of the Alliance of Small Island States, a group of countries vulnerable to the effects of global warming.

The results of the summit aren't absolutely decisive, on either the trade or the climate issue. The no-protection pledge was often violated, increasingly in harder-to-detect ways such as tax breaks for home industries rather than obvious import taxes.

Meanwhile, failure to agree on climate doesn't stop countries from moving ahead in meeting the Paris agreement's goals, or exceed them if they want to. Additionally, U.S. states and private companies can pursue lower emissions on their own.

G-20 agreements are statements of intent and rely on governments themselves to follow through. Still, they set the tone for global policymaking and enable peer pressure when they're not followed.

Other deals at the summit included an agreement to press internet providers to detect and remove extremist content as a way of fighting terrorist incitement and recruiting.

John Kirton, co-director of the G-20 Research Group at the University of Toronto's Munk School of Global Affairs, called the summit a "very solid success." He pointed to broad agreement on the agenda, much of it focusing on less controversial issues such as women's empowerment and promoting digitalization.

Over the long term, the G-20 implements 72 percent of its promises, and has implemented 80 percent of them since last year's summit in Hangzhou, China, according to Kirton.

The meetings competed for attention with rioting by anti-capitalist demonstrators outside the heavily secured Hamburg Messe convention center. Rioters set up street barricades, looted supermarkets and attacked police with slingshots and firebombs.

The G-20 comprises Argentina, Australia, Brazil, China, Germany, France, Britain, India, Indonesia, Italy, Japan, Canada, South Korea, Mexico, Russia, Saudi Arabia, South Africa, Turkey, the U.S. and the European Union.