Bolivian President Evo Morales resigned on Sunday, caving in following three weeks of sometimes-violent protests over his disputed re-election after the army and police withdrew their backing.
"I resign my post as president," the leftist Morales said in a televised address, capping a day of fast-moving events in which many ministers and senior officials quit as support for Latin America's longest-serving president crumbled.
The streets of La Paz immediately exploded in celebration, with jubilant Bolivians setting off firecrackers and waving the country's red, yellow and green flag.
The main opposition candidate in the election, former president Carlos Mesa, said Bolivians "have taught the world a lesson. Tomorrow Bolivia will be a new country".
Cuba and Venezuela, longtime allies of the leftist leader, as well as Brazil's leftist leader Luiz Inacio Lula da Silva, denounced a "coup".
Morales — a former coca farmer and Bolivia's first indigenous president — was declared the winner of the October 20 presidential election a narrow margin, giving him a controversial fourth term, having first taken power in 2006.
But the opposition said there was fraud in the vote count and three weeks of street protests ensued, during which three people died and hundreds were injured.
The Organization of American States carried out an audit of the election and on Sunday reported irregularities in just about every aspect that it examined: the technology used, the chain of custody of ballots, the integrity of the count, and statistical projections.
As chanting Bolivians kept up demonstrations in the street, the 60-year-old Morales called new elections, but this was not enough to calm the uproar. The commanders of the armed forces and the police joined the calls for the president's resignation.
Armed Forces chief Williams Kaliman told reporters he was asking Morales "to resign his presidential mandate to allow for pacification and the maintaining of stability, for the good of our Bolivia".
Cracks had already appeared inside his own government, with the head of the lower house of parliament and the ministers of mines and hydrocarbons announcing their resignations.
Those were followed by a raft of other ministerial resignations after Morales' announcement and raised the question of who was in charge, given that vice-president Alvaro Garcia Lineraalso resigned.
Under the constitution, power then passes to the president of the Senate and the speaker of the lower house of Congress in that order. But both of them have resigned, too.
Constitutional lawyer Williams Bascope, close to the opposition, said lawmakers "will have to convene immediately to elect their presidents".
A new Senate leader would thus be tasked with appointing a consensus cabinet and steering the country through to elections and a transition period.
Morales lashed out against the OAS mission after its announcement, accusing it of making a "political decision" instead of a technical one.
"Some OAS technicians are at the service of [...] power groups."
To make the announcement that he was stepping down, Morales traveled by plane to the coca-growing Chimore region of central Bolivia, the cradle of his career in politics.
It was there in the 1980s that Bolivia's first indigenous president made his name as a combative union leader defending farmers who grow coca, which in the Bolivian countryside is used for medicinal and other purposes. It is also the raw material for making cocaine.
On Sunday night police announced that they had arrested Maria Eugenia Choque, the president of the electoral tribunal that counted the ballots in the election.
Morales insisted he was not running away from his responsibilities.
"I do not have to escape. I have not stolen anything," he said.
"My sin is being indigenous. To be a coca grower.
"Life does not end here. The struggle continues," he said.
"I am resigning so that they (the opposition leaders) do not continue to kick our brothers," he said, referring to violent protests which have marred the weeks since his election victory.
Morales insisted his government was leaving behind "many social triumphs".
The World Bank has credited his government for a decrease in the poverty rate from 45 per cent of the population in 2010 to 35 percent in 2018.
On social media, Bolivians speculated that Morales might leave the country, perhaps going to Argentina, which just elected a center-left government.
Allies denounce 'coup'
With the situation in Bolivia unclear following the fast-moving events, regional heavyweight Colombia called for urgent meeting of the OAS permanent council "in order to look for solutions to a complex institutional situation" in Bolivia.
In the immediate aftermath of the shock announcement, Latin American leftist allies rallied to denounce a coup against one of their own.
Venezuela's President Nicolas Maduro called for a mobilization of political and social movements "to demand the preservation of the life of the Bolivian native peoples, victims of racism".
Cuba's Foreign Minister Bruno Rodriguez described Morales — an Aymara indian — as "a protagonist and a symbol of the rights of the indigenous peoples of our Americas".
Brazil's Lula insisted "my friend Morales" had been removed in a coup, evidence of "an economic elite in Latin America that did not know how to share democracy with poor people".