''We have sealed the deal,'' the United Nations Secretary-General, Ban Ki-moon, said. ''This accord cannot be everything that everyone hoped for, but it is an essential beginning.''

The accord was formally recognized by the UN conference in Copenhagen in its closing session even as some of its smaller members condemned its lack of ambition.

The deal was struck after a marathon round of negotiations between 26 world leaders, including the Prime Minister, Kevin Rudd, which almost collapsed several times as it was progressively watered down by China and the US.

The exhaustion on the faces of the European leaders was matched by the disappointment when they finally faced the media at 2am on Saturday. The Swedish Prime Minister, Fredrik Reinfeldt, acting as President of the European Union, and Jose Manuel Barroso, President of the European Commission, had just given their grudging agreement to the flimsy document, just several pages long, that was supposed to guide the world in its fight against climate change.

''Let's be honest and say that this is not a perfect agreement. It will not solve the climate threat,'' Mr. Reinfeldt said as the last draft of the accord was running off the photocopiers.

He admitted that throughout the long day and night all hope of an ambitious politically binding agreement had been crushed by China and the US. ''We have been fighting not to go backwards,'' he said.

Yet in those early hours of Saturday, the Europeans, along with Mr. Rudd and his British counterpart, Gordon Brown, faced the media one after the other to defend the accord that environmental groups and many small, vulnerable nations were calling a catastrophe.

''This represents a significant global agreement,'' Mr. Rudd insisted. His Climate Change Minister, Penny Wong, stood beside him looking shattered, whether from exhaustion, disappointment or a combination of both was unclear. By then, Senator Wong had been in negotiations for 24 hours, working through the gritty details of the deal.

Mr. Rudd had to acknowledge the accord's obvious flaw: the emissions cuts promised in the document, even at their most ambitious, failed to match the promise of avoiding dangerous climate change.

''A huge amount of work still remains to be done,'' he conceded. ''But the alternative, which we confronted, staring into the abyss at midnight last night, [was] these negotiations collapsing altogether and throwing back all progress that has been reached in recent times in global climate change action.''

Almost two hours earlier, before Mr. Rudd, Mr. Brown and the Europeans had emerged from their final leaders' meeting, the US President, Barack Obama, had announced the accord to the travelling White House press corps as he prepared to fly out of Copenhagen.

A reporter queried the President's departure before the draft was finalized. ''Does it require signing, is it that kind of agreement?'' The President replied vaguely: ''You know, it raises an interesting question as to whether technically there's actually a signature - since, as I said, it's not a legally binding agreement, I don't know what the protocols are.''

But Mr. Obama quickly added: ''I do think that this is a commitment that we, as the United States, are making and that we think is very important.'' Then he raised his hands. ''All right. Thanks, guys.'' And briskly he left for Air Force One.

Mr. Obama had been in Copenhagen for less than 14 hours.

In that time, he had done a deal with the Chinese Premier, Wen Jiabao, that steamrolled over the UN climate negotiations. The US and China had wrested control of the strategic decision-making from the Europeans. Any future climate change agreements will be dictated by their joint level of ambition.

After almost two weeks of debate, where minister after minister, and leader after leader, had spoken passionately about the threat facing the planet, after all the mass protests, the pleas, the prayers and the promises, what had emerged was not ''the grand bargain'' called for by Mr. Rudd, but the weak compromise so many had predicted.

The Copenhagen accord lacks legal force. In the last hours of the conference on Saturday, nations agreed only to ''take note'' of the agreement.

But despite all the criticism, the last two weeks cannot be seen simply as a failure. For all its many flaws, the summit brought together 119 world leaders who acknowledged for the first time that climate change is one of the greatest economic and security challenges facing the planet.