Bolivian President Evo Morales has resigned after the unrest that followed his controversial reelection last month.
On Sunday, international observers called for the cancellation of the election results, saying they had found "clear manipulations" of the October 20 poll.
Morales approved the conclusions and announced his intention to convene new elections – after the recast of the country's electoral body.
But politicians – the army and police chiefs – had urged him to resign.
Some of his allies were attacked earlier this week and claimed that their homes had been burned down.
In a televised speech, Morales announced that he would resign as president and urged protesters to "stop attacking siblings, stop burning and attacking".
- The turbulent race of Evo Morales
- Country Profile
Vice-President Alvaro Garcia Linera and Senate President Adriana Salvatierra also resigned.
Protesters took to the streets to celebrate, chanting "Yes, we could" and setting off firecrackers.
How did we come here?
Bolivia has been shaken by weeks of anti-government demonstrations, following reports of electoral fraud.
The tensions first broke out the night of the presidential election after an inexplicable pause in the count of the results for 24 hours. The final result gives Morales a little more than the 10 percentage point lead he needed to win the first lap of the race.
At least three people died in the clashes that followed. Uniformed police officers also joined the protesters.
On Sunday, the Organization of American States, which monitored the elections, said it found evidence of large-scale data manipulation and could not be able to certify the outcome of previous polls.
The pressure continued to grow on Morales during the day, as several of his political allies resigned, some citing fears for the safety of their families.
The army chief, General Williams Kaliman, also urged Morales to resign "to allow the pacification and maintenance of stability".
The army also announced that it would conduct operations to "neutralize" all armed groups that attacked the protesters.
What was the reaction?
Opposition leader Carlos Mesa – who came second in the poll last month – thanked the protesters for "the heroism of peaceful resistance".
In a tweet, he described development as "the end of tyranny" and a "history lesson," saying, "Long live Bolivia!"
However, Cuban and Venezuelan leaders – who had previously expressed their support for Morales – condemned the events as a "coup d'etat".
Cuban President Miguel Diaz-Canel described the attempt as a "violent and cowardly" attempt against democracy, while Venezuelan leader Nicolas Maduro said on Twitter: "We categorically condemn the coup d'etat against our brother on President."
Who is Evo Morales?
Morales, who was Bolivia's first indigenous president, has been at the helm of the party since 2006.
He went for a fourth consecutive term in the October elections after a controversial decision by the constitutional court to remove the boundaries of the presidential term.
In the 2016 referendum, a majority voted "no" in favor of abandoning the limit on the number of terms that Bolivians could serve.
However, the party of Mr. Morales brought the case before the constitutional court, which completely abolished the term of office.