Two weeks of intense negotiations, 30 hours into extra time. The moment the gavel went down, there was a huge sense of relief in the plenary hall at the United Nations climate talks in Katowice, southern Poland, late on Saturday.
"Mission accomplished! #KatowiceClimatePackage adopted!" Mr Michal Kurtyka, president of the talks and State Secretary of Poland's Ministry of Energy, tweeted.
"(With) approximately 200 countries in the room, (it) is not easy to find a deal so specific and so technical. But every single step forward is a big achievement. And through this package, you have made a thousand little steps forward together," he told the plenary.
Delegates erupted into cheers, hugs and a standing ovation at the adoption of the Katowice Rulebook deal that aims to ramp up the fight against climate change.
Others criticised it as not ambitious enough by failing to urge nations to make faster and deeper emission cuts, and said the world remains dangerously off track because current pledges put the planet on course to warm at least 3 deg C.
Nonetheless, an overjoyed Mr Kurtyka leapt from the head table on to the main stage to applause in the chamber after a fraught two weeks, in which Poland was criticised for hosting the talks in a city at the heart of the nation's huge coal mining industry.
At the talks, called COP24, delegates agreed on a set of technical rules to put the 2015 Paris Climate Agreement into action from 2020.
Katowice marked the end of three years of negotiations on those rules, and the 133-page road map means countries can now set to work in collectively cutting emissions, particularly carbon dioxide, the main greenhouse gas from burning fossil fuels, agriculture and deforestation.
"The multilateral system has delivered a solid result. This is a road map for the international community to decisively address climate change," said Ms Patricia Espinosa, executive secretary of the UN Framework Convention on Climate Change, under which the talks were held.
UN Secretary-General Antonio Guterres said: "From now on, my five priorities will be: ambition, ambition, ambition, ambition and ambition."
Mr Guterres visited the talks three times to rally delegates, and is pushing countries to pledge deeper emission cuts from 2020, during his climate summit at the UN in September next year.
Youth delegates, green groups and vulnerable, small island states were very vocal at the talks, calling for much greater action to cut greenhouse gas emissions that scientists say are heating up the planet and causing severe weather disruptions.
The face of the talks was schoolgirl Greta Thunberg, a 15-year-old Swedish climate activist who has inspired global strikes by schoolchildren and university students angry over the lack of action on climate change and the escalating damage from more extreme droughts, floods, heatwaves, damage to coral reefs and threats to crop yields.
"You say you love your children above all else, and yet you are stealing their future before their very eyes," she said in a speech to delegates.
The view that the future of youth, and the planet, is at stake, and vulnerable nations are being threatened with extinction, permeated the talks.
"The reality is that the world has not yet turned the corner to aggressively drive down global emissions," said Ms Helen Mountford, vice-president for global climate and economics at the Washingtonbased World Resources Institute. "And the window is closing."
"The Paris Agreement is grounded in a vision of the world working together, united by a spirit of cooperation. Heads of state urgently need to take bold measures in their countries and collectively cut emissions, enhance resilience and seize the economic and social benefits that can propel us to a safer, more prosperous future," said Ms Mountford.
That call for stronger, faster action was echoed by others.
"Without immediate action, even the strongest rules will not get us anywhere. People expected action, and that is what governments did not deliver."
"This is morally unacceptable, and they must now carry with them the outrage of people and come to the UN Secretary-General's summit in 2019 with higher climate action targets," said Greenpeace International executive director Jennifer Morgan.