Image copyright AFP Image caption Developing countries have accused wealthier nations of failing to take responsibility for climate change

United Nations members have reached an agreement on how countries should tackle climate change.

Delegates have approved a framework for setting national pledges to be submitted to a summit next year.

Differences over the draft text caused the two-week talks in Lima, Peru, to overrun by two days.

Environmental groups said the deal was an ineffectual compromise, but the EU said it was a step towards achieving a global climate deal next year in Paris.

The talks proved difficult because of divisions between rich and poor countries over how to spread the burden of pledges to cut carbon emissions.

'Not perfect'

The agreement was adopted hours after a previous draft was rejected by developing countries, who accused rich nations of shirking their responsibilities to fight global warming and pay for its impacts.

Peru's environment minister, Manuel Pulgar-Vidal, who chaired the summit, told reporters: "As a text it's not perfect, but it includes the positions of the parties."

Miguel Arias Canete, EU Commissioner for Climate Action and Energy, said the EU had wanted a more ambitious outcome but he still believed that "we are on track to agree a global deal" at a summit in Paris, France, next year.

UK climate change minister Ed Davey said: "I am not going to say it will be a walk in the park in Paris."

He described the deal as "a really important step" on the road to Paris.

"That's when the real deal has to be done."

Analysis: Matt McGrath, BBC News, Lima

Image copyright EPA

There was a good deal of optimism at the start of these talks as the recent emissions agreement between the US and China was seen as an historic breakthrough. But that good spirit seemed to evaporate in two weeks of intense wrangling between rich and poor here in Lima.

It ended in a compromise that some participants believe keeps the world on track to reach a new global treaty by the end of next year.

None of the 194 countries attending the talks walked away with everything they wanted, but everybody got something.

As well as pledges and finance, the agreement points towards a new classification of nations. Rather than just being divided into rich and poor, the text attempts to reflects the more complex world of today, where the bulk of emissions originate in developing countries.

While progress in Lima was limited, and many decisions were simply postponed, the fact that 194 nations assented to this document means there is still momentum for a deal in Paris. Much tougher tests lie ahead.

Climate deal heralds historic shift

Image copyright Reuters Image caption The talks, which began on 1 December, had been due to end on Friday but ran over into the weekend

The final draft is said to have alleviated those concerns with by saying countries have "common but differentiated responsibilities".

"We've got what we wanted," Indian environment minister Prakash Javedekar told reporters, saying the document preserved the notion that richer nations had to lead the way in making cuts in emissions.

It also restored a promise to poorer countries that a "loss and damage" scheme would be established to help them cope with the financial implications of rising temperatures.

However, it weakened language on national pledges, saying countries "may" instead of "shall" include quantifiable information showing how they intend to meet their emissions targets.

The agreed document calls for:

An "ambitious agreement" in 2015 that reflects "differentiated responsibilities and respective capabilities" of each nation

Developed countries to provide financial support to "vulnerable" developing nations

National pledges to be submitted by the first quarter of 2015 by those states "ready to do so"

Countries to set targets that go beyond their "current undertaking"

The UN climate change body to report back on the national pledges in November 2015

Environmental groups were scathing in their response to the document, saying the proposals were nowhere need drastic enough.

Sam Smith, chief of climate policy for the environmental group WWF, said: "The text went from weak to weaker to weakest and it's very weak indeed."

Jagoda Munic, chairperson of Friends of the Earth International, said fears the talks would fail to deliver "a fair and ambitious outcome" had been proven "tragically accurate".