Bolivia’s President Evo Morales resigned on Sunday after three weeks of occasionally violent protests.
"I resign my post as president," Mr Morales said in a televised address, at the end of a frantic day when support for Latin America's longest-serving president crumbled.
"I ask you to stop attacking the brothers and sisters, stop burning and attacking."
The announcement set off celebrations in the streets, with people setting off fireworks and honking car horns.
Mr Morales' decision followed a public backlash over a disputed election last month and a call for him to step down by the head of the country's military.
"After analysing the situation of internal conflict, we ask the president to resign, allowing peace to be restored and stability to be maintained for the good of our Bolivia," Gen Williams Kaliman said on Sunday.
It was not immediately clear who would succeed Mr Morales, or how his successor would be chosen.
His vice president also resigned as did the Senate president, who was next in line. The only other official listed by the constitution as a successor, the head of the lower house, had resigned earlier.
Mr Morales, the first member of Bolivia's indigenous community to become president, claimed to have won a fourth term last month, setting off protests in which three people died and more than 100 were injured.
Mr Morales had earlier on Sunday accepted calls for a new election by an Organisation of American States team that found a “heap of observed irregularities” in the October 20 election. The official result showed him getting just enough votes to avoid a run-off against a united opposition.
Cuba described his resignation as a "coup".
Foreign Minister, Bruno Rodriguez, said Cuba "expresses solidarity with its brother, president Evo Morales", and said he was "a protagonist and a symbol of the rights of the indigenous peoples of our Americas".
Mexican Foreign Secretary Marcelo Ebrard said his country would offer asylum to Mr Morales should he ask for it. There was no indication that Mr Morales had done that.
In a tweet, Mr Ebrard said: "Mexico will maintain its position of respect for democracy and institutions. Coup no."
Jeremy Corbyn, the left-wing leader of UK opposition party Labour, also described it as a "coup".
On Monday, the Russian government, also an ally of Mr Morales, said violent action by the opposition had forced Morales out, while UN Secretary General Antonio Guterres called for "restraint" from all sides.