It was very nearly a diplomatic disaster.

Alok Sharma, the president of the U.N. climate conference in Scotland, had convened the final meeting of representatives from nearly 200 countries to deliver the Glasgow Climate Pact, a deal meant to ensure the world still has a chance to avert the worst impacts of global warming.

It was moment born of weeks of arduous negotiation and months of painstaking preparations. Delegates in the plenary hall at COP26 were taking pictures to mark the historic moment.