UN climate talks in Scotland ended with a global agreement aimed at keeping alive hopes of capping global warming at 1.5 degrees Celsius, and so maintain a realistic shot at saving the world from catastrophic climate change.
Alok Sharma, the conference chairman, was visibly emotional before banging down his gavel in relief to signal that there were no vetoes from the almost 200 national delegations present in Glasgow, ranging from coal- and gas-fuelled superpowers to oil producers and Pacific islands being swallowed by the rise in sea levels.
The two-week conference in Glasgow, which extended into an extra day of tortuous negotiations, was the 26th of its kind but the first to call for a reduction in fossil fuels, which not only power much of the world's economy but are also the main cause of manmade global warming.
There was last-minute drama as India, backed by China and other coal-dependent developing nations, raised objections to this part of the agreement and asked for the wording to be rewritten. The clause was hurriedly amended to ask countries to accelerate their efforts towards a coal power "phase down" instead of "phase out".
India's environment and climate minister, Bhupender Yadav, said the revision was needed to reflect the "national circumstances of emerging economies."
"We are becoming the voice of the developing countries," he told Reuters, adding that coal had been "singled out" during the COP26 talks while there was no similar call to phase out oil or natural gas.
"We made our effort to make a consensus that is reasonable for developing countries and reasonable for climate justice," he said, alluding to the fact that rich nations historically have emitted the largest share of greenhouse gases.
The one-word change in the agreement was met with dismay by the rich economies of the European Union and Switzerland, as well as by a large group of small island states, whose existence is under threat from rising sea levels.
But all said they would let it stand for the sake of an overall agreement.
"The approved texts are a compromise. They reflect the interests, the conditions, the contradictions and the state of political will in the world today," said UN Secretary-General Antonio Guterres.
"They take important steps, but unfortunately the collective political will was not enough to overcome some deep contradictions."
Sharma had had the onerous task of balancing the demands of climate-vulnerable nations, big industrial powers, and those like India and China whose consumption or exports of fossil fuels are vital to their economic development.
His voice broke with emotion after he heard vulnerable nations express their anger over the last-minute changes.
"May I just say to all delegates I apologise for the way this process has unfolded and I am deeply sorry," he told the assembly.
"I also understand the deep disappointment but I think, as you have noted, it's also vital that we protect this package."
The overarching aim that he set before the conference was one that climate campaigners and vulnerable countries had found far too modest - namely, to "keep alive" the 2015 Paris Agreement's target to cap global warming at 1.5 degrees Celsius (2.7 Fahrenheit) above pre-industrial levels.
The agreement in effect acknowledged that commitments made so far to cut emissions of planet-heating greenhouse gases are nowhere near enough, and asked nations to set tougher climate pledges next year, rather than every five years, as they are currently required to do.
Scientists say that to go beyond a rise of 1.5C would unleash extreme sea level rise and catastrophes including crippling droughts, monstrous storms and wildfires far worse than those the world is already suffering.
But national pledges made so far to cut greenhouse emissions - mostly carbon dioxide from burning coal, oil and gas - would only cap the average global temperature rise at 2.4 Celsius.
'THE ERA OF COAL IS ENDING'
Jennifer Morgan, executive director of the campaign group Greenpeace, saw the glass as half-full.
"They changed a word but they can't change the signal coming out of this COP, that the era of coal is ending," she said. "If you're a coal company executive, this COP saw a bad outcome."
Developing countries argue that rich nations, whose historical emissions are largely responsible for heating up the planet, must pay more to help them adapt to its consequences as well as reducing their carbon footprints.
The deal gave the poorest nations more promises, but no guarantees, that they would finally get more of the financial help they have long been told they will get.
It urged rich countries to double finance for climate adaptation by 2025 from 2019 levels, offering funding that has been a key demand of small island nations at the conference.
Adaptation funds primarily go to the very poorest countries and currently take up only a small fraction of climate funding.
A UN committee will also report next year on progress towards delivering the $100 billion per year in overall annual climate funding that rich nations had promised by 2020 but failed to deliver. And governments will be summoned to meet in 2022, 2024 and 2026 to discuss climate finance.
Yet even $100 billion a year is far short of poorer countries' actual needs, which could hit $300 billion by 2030 in adaptation costs alone, according to the United Nations, in addition to economic losses from crop failure or climate-related disasters.