Deadlock over climate change between the United States and the other G20 nations appears to have been broken.
The BBC understands a compromise final closing text has been agreed at the second day of their summit in Hamburg.
According to an EU official, the text acknowledges President Donald Trump’s withdrawal from the Paris climate agreement without undermining the commitment of other countries.
It comes after a second night of violent protests in Hamburg.
Negotiators worked through the night in an attempt to reach a compromise on the wording of the summit statement.
Meanwhile leaders have held separate talks. President Donald Trump met British PM Theresa May, and said a US-UK trade deal would be signed soon.
The host, German Chancellor Angela Merkel, held a working breakfast with Presidents Putin of Russia and Macron of France. On Friday had described the first day of talks as “very difficult”.
But early on Saturday, an EU official told Reuters news agency: “The outcome is good. We have a communiqué. There is just one outstanding issue on climate.” He added that the statement included a pledge to “fight protectionism”.
Mr Trump, after his morning meeting with Ms May, said he expected a “very powerful” trade deal between the two countries “very quickly”.
- Trump: UK-US trade deal to happen quickly
- Who are the G20 protesters?
- Watch: Battles between police and protesters
- In pictures: Violence at G20 protests
- How much do world leaders earn?
The G20 (Group of Twenty) is a summit for 19 countries, both developed and developing, plus the EU
Why do parts of Hamburg resemble a war zone?
There have been large protests on the streets of Hamburg, with demonstrators and armed police clashing into the early hours of Saturday.
Demonstrators – who were protesting against the presence of Mr Trump and Mr Putin, climate change and global wealth inequalities – set fire to vehicles and barricades, threw rocks at officers and looted shops.
At one point, police chased protesters across rooftops while officers on the streets used water cannon on protesters.
Nearly 200 police officers were injured during the protests. Dozens of protesters have been detained.
What happened when Trump met Putin?
On Friday, Mr Trump used his first meeting with Russian President Vladimir Putin on the sidelines of the G20 to discuss the alleged Russian hacking of last year’s US presidential election.
Both sides called the meeting positive – but differed in their descriptions of the hacking discussion.
Russian Foreign Minister Sergei Lavrov said “President Trump said he heard clear statements… that Russian authorities did not intervene [in the US election], and he accepted these declarations.”
However, US Secretary of State Rex Tillerson said Mr Trump “opened the meeting with President Putin by raising the concerns of the American people regarding Russian interference in the 2016 election.
“They had a very robust and lengthy exchange on the subject. The president pressed President Putin on more than one occasion regarding Russian involvement.”
He said it was not clear whether the two countries would ever come to an agreement on what happened.
Other topics discussed during their meeting included the war in Syria, terrorism and cybersecurity.