“Let me tell you that as a text, it’s not perfect but it includes the positions of the parties. Everybody wins with this text. No exceptions,” said Manuel Pulgar Vida, Peru’s Environment Minister.

The deal at the end of the two-week talks makes it clear that rich countries would have to pay for poor countries to cope with a warmer world.

It commits all countries to cutting greenhouse gases and appeases developing countries such as China and India.

They had been concerned that they’d have too heavy a burden compared to richer nations in the global effort to address climate change.

But not everybody is happy. Many say the deal agreed in Lima is weak and they want real action on climate change.

“So we came in here on a wave of optimism,” said Samantha Smith of the World Wildlife Fund’s (WWF) Climate and Energy Initiative.”

Refering to an agreement last week by China and the US, the world’s top two polluters, to limit greenhouse gases, Smith continued: “We had these announcements from the US and China. We had lots of good announcements from Latin America about renewable energy, about protecting forests. And where we are now is that we have a weak text and we have an incredibly hard road to Paris if we want to have a good global deal.”

Under the Lima deal, governments will submit national plans for reining in rising emissions before the end of March 2015.

That will be the foundation for the global agreement due at a summit in Paris, France next December.