Bolivian President Evo Morales has resigned amid turmoil following his disputed re-election last month.
On Sunday, international monitors called for the election result to be annulled, saying they had found “clear manipulations” of the 20 October poll.
Mr Morales agreed with the findings and announced his intention to call fresh elections – after overhauling the country election body.
But politicians – and the army and police chiefs – had urged him to quit.
In a televised address, Mr Morales said he would resign as president, and urged protesters to “stop attacking the brothers and sisters, stop burning and attacking”.
Some of his allies were attacked earlier this week, and said their homes had been set alight.
The Vice-President, Alvaro Garcia Linera, also resigned.
Protesters took to the streets to celebrate, chanting “yes we could” and setting off fire crackers.
How did we get here?
Bolivia has been rattled by weeks of anti-government protests, following reports of election fraud in the presidential election.
At least three people died during clashes. Some uniformed police officers also joined the protesters.
On Sunday, the Organization of American States, which monitored the elections, said it had found evidence of wide-scale data manipulation, and could not certify the result of the previous polls.
Pressure continued to build on Mr 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 Mr Morales to resign “to allow for pacification and the maintaining of stability”.
) The military also said it would conduct operations to “neutralize” any armed groups that attacked the protesters.
What reaction has there been?
Opposition leader Carlos Mesa – who came second in last month’s poll – described thanked protesters for “the heroism of peaceful resistance”.
In a tweet, he described the development as “the end of tyranny” and a “historical lesson”, adding: “Long live Bolivia! “
However, the Cuban and Venezuelan leaders – who had previously voiced their support for Mr Morales – condemned the events as a “coup”.