Ecuador's government has agreed to restore fuel subsidies in a deal with indigenous leaders to end mass protests that have brought the capital, Quito, to a standstill, the UN says.
It came after the two sides held talks brokered by the UN and the Roman Catholic Church.
The talks, which were broadcast live on state television, came after nearly two weeks of violent demonstrations.
President Lenín Moreno had imposed a curfew enforced by the military.
What's in the agreement?
A joint statement said the government had withdrawn an order removing the fuel subsidies.
"With this agreement, the mobilisations... across Ecuador are terminated and we commit ourselves to restoring peace in the country," it said.
The two sides will now discuss a new law to ensure subsidies are not exploited by people who smuggle fuel to neighbouring countries.
Government official Juan Sebastián Roldán said talks to start drafting the new law would start immediately.
"Conceding is not losing," he said. "Here we are all conceding."
A commission will also be set up to re-establish peace in the stricken Andean nation, with mediation by the Catholic Church, the UN and others.
A blow for Moreno
Analysis by Will Grant, BBC Central America correspondent
The protest leaders in the negotiating room applauded while President Moreno gave no response.
This is undoubtedly a blow for him. Decree 883 was the main issue which prompted people to take to the streets in the first place and the president had repeatedly said there would be no going back on it.
However, given the intense and widespread protests over the past 12 days, in the end he had little choice.
The calls for his resignation have been growing louder with each protest and President Moreno has looked increasingly vulnerable - especially since a number of demonstrators were killed in clashes with riot police.
What has been the reaction?
The announcement after Sunday's meeting sparked late-night celebrations in the capital Quito. People shouted "yes, we could" and "the people, united, will never be defeated".
Fireworks were set off and car drivers honked their horns.
A resident, Cristina Vasquez, told Reuters news agency she wanted to praise the contribution of Ecuador's indigenous people, who were at the forefront of the protests: "More than a celebration it is an appreciation of the indigenous people who represented us and helped because this is a win for everyone."
The indigenous umbrella group Conaie called on its members to come together to "clean the streets" of barricades and debris after the damage caused by 12 days of protests.
How did the protests come about?
The protests began after the government announced an end to fuel subsidies as part of public spending cuts agreed with the International Monetary Fund (IMF) in return for a loan.
Mr Moreno said the subsidies, which cost the government $1.3bn (£1bn) annually and were introduced in the 1970s, were no longer affordable. Eliminating them was part of his plan to shore up Ecuador's flagging economy.
But petrol prices soared and thousands took to the streets.
Clashes between protesters and riot police led Mr Moreno to declare a two-month national emergency. He accused his opponents of attempting a coup.
As the violence grew worse Mr Moreno temporarily moved government operations from Quito to the port city of Guayaquil.
Seven people died during the protests, more than 1,300 were injured and 1,152 were detained, according to official figures.
Protesters also took dozens of officers hostage in various locations throughout the country.
Indigenous-led protests have toppled three presidents in the past few decades.