U.N. climate change talks agreed on a pact on Sunday that for the first time would force all the biggest polluters to take action to slow the pace of global changing.

The deal follows years of failed attempts to impose legally-binding, international cuts on emerging giants, such as China and India.

The developed world had already accepted formal targets under a first phase of the Kyoto Protocol, which runs out at the end of next year, although the United States had never ratified its commitment.

After days of emotional debate, the chairwoman of the United Nations climate talks urged delegates to approve four packages, which have legal force.

We came here with plan A, and we have concluded this meeting with plan A to save one planet for the future of our children and our grandchildren to come, South African Foreign Minister Maite Nkoana-Mashabane said.

We have made history, she said, bringing the hammer down on more than two weeks of sometimes fractious talks in the South African port of Durban, the longest in two decades of U.N. climate talks.

The deal was welcomed by Brazil, one of the globe's emerging economic powers.

I am relieved we have what we came here to get. We have a robust outcome, an excellent text about a new phase in the international fight against climate change. It clearly points to action, said Brazil's climate envoy Luiz Alberto Figueiredo.

The Durban talks had been due to wrap up on Friday, but dragged into a second extra day on Sunday because of disputes over how to phrase the legal commitment.

The European Union pushed for strong wording and the three biggest emitters the United States, China and India resisted.

We've had very intense discussions, we were not happy with reopening the text, but in the spirit of flexibility and accommodation shown by all, we have shown our flexibility, we have agreed to the words you just mentioned and we agree to adopt it, India's Environment Minister Jayanthi Natarajan said.

But environmentalists and small island states, which fear they literally could sink under the rising sea levels caused by climate change, have said it is still not strong enough.

(Reporting by Nina Chestney, Barbara Lewis, Agnieszka Flak, Andrew Allan, Michael Szabo and Stian Reklev; editing by Jon Boyle)