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, according to the BBC.
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".
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 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.