Image copyright Kiara Worth/IISD Image caption Some of the difficult issues proved impossible to resolve in Madrid

The longest United Nations climate talks on record have finally ended in Madrid with a compromise deal.

Exhausted delegates reached agreement on the key question of increasing the global response to curbing carbon.

All countries will need to put new climate pledges on the table by the time of the next major conference in Glasgow next year.

Divisions over other questions - including carbon markets - were delayed until the next gathering.

What was agreed?

After two extra days and nights of negotiations, delegates finally agreed a deal that will see new, improved carbon cutting plans on the table by the time of the Glasgow conference next year.

All parties will need to address the gap between what the science says is necessary to avoid dangerous climate change, and the current state of play which would see the world go past this threshold in the 2030s.

Supported by the European Union and small island states, the push for higher ambition was opposed by a range of countries including the US, Brazil, India and China.

However a compromise was agreed with the richer nations having to show that they have kept their promises on climate change in the years before 2020.

Huge pressure on UK

Next year's big climate conference will be held in Glasgow, Scotland - and that heaps enormous pressure on UK Prime Minister Boris Johnson.

He's already been warned by environmentalists that he will be "humiliated" if he tries to lead other nations whilst the UK is still failing to meet its own medium-term climate targets.

The UK's climate advisers warn that tens of millions of homes must be insulated.

Other experts say Mr Johnson's £28.8bn road-building plans are not compatible with eliminating CO2 emissions.

They say even fully electric cars won't solve the problem completely - and urge the government to help people walk and cycle to benefit their health and the environment.

They also say expanding aviation will increase emissions.

Mr Johnson's Brexit decisions will play a part too. The US won't discuss climate change in any trade deal. Meanwhile the EU is putting a border tax on countries that don't cut greenhouse gases. It will be impossible to please both.

What is the reaction?

UN Secretary General Antonio Guterres said he was disappointed by the result.

"The international community lost an important opportunity to show increased ambition on mitigation, adaptation and finance to tackle the climate crisis," he said, quoted by AFP.

'Another year of failure'

Meanwhile, Laurence Tubiana from the European Climate Foundation, and an architect of the Paris agreement, described the result as "really a mixed bag, and a far cry from what science tells us is needed."

"Major players who needed to deliver in Madrid did not live up to expectations, but thanks to a progressive alliance of small island states, European, African and Latin American countries, we obtained the best possible outcome, against the will of big polluters."

Decisions on other issues including the thorny question of carbon markets have been delayed until Glasgow.

Show More

This aspect of the deal was welcomed by campaigners.

"Thankfully the weak rules on a market based mechanism, promoted by Brazil and Australia, that would have undermined efforts to reduce emissions has been shelved and the fight on that can continue next year at COP26 in Glasgow," said Mohamed Adow, with the group Power Shift Africa.

Video caption Climate change: How 1.5C could change the world

Many of those in attendance were unhappy with the overall package, feeling it did not reflect the urgency of the science.

Spain's acting Minister for the Ecological Transition Teresa Ribera said the mandate was clear.

"Countries have to present more ambitious NDCs [nationally determined contributions] in 2020 than what we have today because it is important to address science and the demands of people, as well as commit ourselves to do more and faster."

However, negotiators will be satisfied to have kept the process alive after these difficult and complex talks in Madrid.

What is the evidence for global warming?

The world is now nearly one degree Celsius warmer than it was before widespread industrialisation, according to the World Meteorological Organization (WMO).

The 20 warmest years on record have all occurred in the past 22 years , with the years from 2015-2018 making up the top four.

The WMO says that if the current warming trend continues, temperatures could rise by 3-5C by the end of this century.

A threshold of 2C had long been regarded as the gateway to dangerous warming. More recently, scientists and policy makers have argued that keeping temperature rise to within 1.5C is a safer limit for the world.

But an IPCC report in 2018 suggested that keeping to the 1.5C target would require "rapid, far-reaching and unprecedented changes in all aspects of society".

How will climate change affect us?

There are varying degrees of uncertainty about the scale of potential impacts.

But the changes could drive freshwater shortages, bring sweeping changes to our ability to produce food, and increase the number of deaths from floods, storms, heat waves and droughts.

Even if we cut greenhouse gas emissions dramatically now, scientists say the effects will continue because parts of the climate system, particularly large bodies of water and ice, can take hundreds of years to respond to changes in temperature.

It also takes greenhouse gases decades to be removed from the atmosphere.

Follow Matt on Twitter.