World leaders made concessions on trade and climate language to Donald Trump Saturday at the end of the most fractious and riot-hit G-20 summit ever, in exchange for preserving a fragile unity of the club of major industrialized and emerging economies.
In a departure from final summit declarations that tend to outline consensus on issues that range from fighting terrorism to financial governance, the extraordinary conclusions this year spelt out differences on core issues.
It acknowledged Trump's decision to go his own way on taking the United States out of the 2015 Paris climate accord and clearly stated Washington's wish to continue using and selling fossil fuels that are a main driver of global warming.
The declaration also stated for the first time the right of countries to protect their markets with "legitimate trade defense instruments" — wording that essentially gives Trump wiggle room to push on with his "America First" policy.
Trump, carried to the White House on a wave of public fury over deindustrialization in vast areas of the United States, has launched "Buy American" and "Hire American" campaigns.
The nationalistic stance has set him on collision course with many of America's allies, who warned Trump against an isolationist path and starting a trade war.
"Where there is no consensus, the communique spelt out the discord," said host Chancellor Angela Merkel, who was praised by Russian President Vladimir Putin for finding an "optimal compromise" on the touchiest issue of climate.
French President Emmanuel Macron also hailed the approach, saying that the club found an "indispensable balance" through the text and halted any backsliding on fighting climate change, which is blamed for melting ice caps, rising seas and severe weather events.
The French leader, at his first G-20 gathering, said he hadn't given up on trying to change Trump's mind on global warming.
Saying that he "never gives up hope on convincing" others, Macron added that "therefore I confirm that I hope to convince him."
Thomas Bernes from the think-tank Center for International Governance Innovation described the final declaration as a "masquerade."
"When compared to the G-20 dynamic since the London summit in 2009, it's a step back: a clear signal against protectionism to fight the financial crisis becomes a mixed signal.
"It's a totally different dynamic, when compared to what we've seen before: usually it was about moving forward, not avoiding to move backward," he added.
If the meetings within the tightly secured G-20 summit venue were anything but harmonious, outside chaos and violence gripped Germany's second city.
Ten minutes' walk from the summit venue, charred road barricades, trashed shops, debris and shattered glass bore testimony to an anarchic Friday night of street clashes between protesters and police, when commandoes chased militants who hurled rocks from rooftops.
The clashes had blocked US first lady Melania Trump at her residence on Friday, forcing her to miss a tour of Hamburg harbor, and for G-20 organizers to completely alter a program for spouses of visiting leaders.
On Saturday, thousands of anti-riot cops were again on guard, as helicopters hovered overhead, with tens of thousands of demonstrators on the march.
Within the summit walls, world leaders were dancing a delicate diplomatic waltz, with discord not only dogging the main G-20 conferences, but also adding tension to the atmosphere in bilateral asides.
Host Merkel herself admitted that "deep differences" remain with Turkish President Recep Tayyip Erdogan after they met on the sidelines of the summit.
But it was Trump's first head-to-head with Russia's leader President Vladimir Putin that stole the show.
A day after Trump slammed Moscow's actions in Ukraine and Syria, the two men had a "robust and lengthy exchange" about allegations of Russian meddling in the 2016 US election, Secretary of State Rex Tillerson said.
But Tillerson, who was present at the meeting that ran for two hours and 15 minutes, also said the two alpha-male leaders "connected very quickly" with "very clear positive chemistry".
Trump said Saturday that the tete-a-tete was "tremendous" while Putin gave an upbeat assessment of ties ahead with the US leader.
"There is every reason to believe that we will be able to at least partially re-establish the level of cooperation that we need," Putin said.
After scoring at his Russian encounter, Trump turned to another thorny meeting, this time with Chinese President Xi Jinping.
North Korea's first intercontinental ballistic missile test announced this week was the key issue, with Trump warning Thursday that Pyongyang's military saber-rattling would bear "consequences".
Entering into talks, Trump told his Chinese counterpart that "something has to be done" on North Korea.
"It may take longer than I'd like, it may take longer that you'd like," Trump said, "but there will be success in the end, one way or the other."
By AFP's Hui Min Neo and Simon Sturdee in Hamburg, Germany.
Sign up for The Top of the World, delivered to your inbox every weekday morning.