Bolivian President Evo Morales has resigned after nearly 14 years in power, amid turmoil following his disputed re-election last month.
The head of the army had called on him to go after protests over his election win.
Auditors found irregularities with the poll but Mr Morales said he had been the victim of a coup.
He said he was leaving to help protect families of political allies, after their homes were burned down.
In a televised address, Mr Morales urged protesters to “stop attacking the brothers and sisters, stop burning and attacking”.
On the streets of La Paz, celebration – for millions of Bolivians, the demise of the region’s longest-standing president could not have come soon enough.
In the end it was a call by the armed forces that signalled the end, telling Evo Morales he had to go for the sake of Bolivia’s stability.
But while for many he was an undemocratic leader holding on to power, for others, especially poor Bolivians, Evo Morales was a president who gave a voice to millions. The first indigenous leader Bolivia ever had, he succeeded in making a deeply unequal society more inclusive.
His supporters have called this a coup – his detractors the end of tyranny. These are uncertain days in South America’s poorest nation.
The 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 fire crackers.
Bolivia has been rattled by weeks of anti-government protests, following the reports of election fraud.
Tensions first flared on the night of the presidential election after the results count was inexplicably stopped for 24 hours. The final result gave Mr Morales slightly more than the 10-percentage-point lead he needed to win outright in the first round of the race.
At least three people died during clashes that followed. 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 military also said it would conduct operations to “neutralise” any armed groups that attacked the protesters.
What reaction has there been?
Opposition leader Carlos Mesa – who came second in last month’s poll – thanked protesters for “the heroism of peaceful resistance”.
In a tweet, he described the development as “the end of tyranny” and a “historical lesson”, saying, “Long live Bolivia!”
However, the Cuban and Venezuelan leaders – who had previously voiced their support for Mr Morales – condemned the events as a “coup”.
Cuban President Miguel Diaz-Canel described it as a “violent and cowardly” attempt against democracy, while Venezuelan leader Nicolas Maduro said tweeted: “We categorically condemn the coup realised against our brother president.”
Mexico says it is considering granting asylum to Mr Morales.