Ecuador began counting the cost of 12 days of indigenous protests against fuel hikes that left eight demonstrators dead and severely dented President Lenin Moreno's austerity programme.
Moreno and indigenous leaders reached an agreement on Sunday after the president pledged to withdraw subsidy cuts, known as Decree 883, that had more than doubled fuel prices.
The cuts were part of an austerity package to obtain a $4.2bn loan from the International Monetary Fund to shore up the oil exporter's brittle economy.
Moreno said that the original plan would be replaced by new measures that "contain mechanisms to focus resources on those who need them most".
Under the deal, indigenous umbrella group CONAIE called off protests that brought chaos to the capital and forced Moreno to relocate his government hundreds of kilometers away to second city Quayaquil.
Thousands of indigenous people began leaving Quito on Monday in convoys of trucks, returning to communities in the Andes and the Amazon rainforest that they left more than a week ago to vent their outrage at the increases.
The ombudsman's office reported that 1 340 people had been injured in the protests, some of whom were in critical condition, and 1 192 people had been detained.
Sunday's breakthrough after four hours of talks was announced by an official from the United Nations, which mediated negotiations along with the Catholic Church.
The top US diplomat for Latin America, Michael Kozak, said the agreement "shows the power of peaceful dialogue and will help bring stability back to the country and prosperity to its people".
Venezuela's President Nicolas Maduro, whom Moreno accused of colluding with ex-president Rafael Correa to stoke indigenous unrest, welcomed "a historic victory over the IMF".
"I congratulate the Ecuadoran people because they have achieved a historic victory over the IMF, by getting the derogation of Decree 883," Maduro said.
Maduro and the Belgium-based Correa scoffed at Moreno's claims that they tried to mount a coup to depose him, but Moreno wasted no time Monday in moving against Correa allies.
Police on Monday arrested the governor of Quito's surrounding province of Pichincha, Paula Pabon.
Police also raided the house of former lawmaker Virgilio Hernandez, while another lawmaker, Gabriela Rivandeneira, took refuge in the Mexican embassy in Quito on Saturday.
"Peace has been restored and put a stop to the Correa-ist coup," Moreno said.
However, the political, economic and social recovery is likely to be long and difficult.
The government had slashed fuel subsidies in order to save $1.3bn a year but will now have to find the savings elsewhere.
"Ecuador has to fulfill its commitments to the IMF because nobody is going to lend to it if they want to continue spending and want to continue living on debt, which is the strategy that has been applied since 2014," analyst Alberto Acosta Burneo told AFP.
"It's going to be very difficult to recover from the fracture caused by the protests," warned indigenous expert Pablo Romero.
Romero, of Quito's Salesian University, said the indigenous people - 25% of Ecuador's 17.3 million population - had won a "symbolic" victory, but the protests had exposed deep rifts and "racism" in the country.
The protest had cost all sides dearly, said Romero.
"The government, because all its weaknesses were exposed; the CONAIE, because divisions in its leadership became apparent; and the country itself."