Bolivian president Evo Morales has resigned amid deepening unrest over allegations of electoral fraud.
The announcement came after the country’s military chief called for him to quit
Mr Morales has endured weeks of violent protests since his election victory last month was called into question, with the Organization of American States (OAS) saying there was “clear manipulation” at the polls.
Three people have been killed and more than 100 injured in clashes between supporters and opponents of the president.
Protesters have also set fire to the headquarters of local electoral offices and set up roadblocks that paralysed parts of the country.
Mr Morales said in televised comments on Sunday that he would submit his resignation letter to restore stability, but claimed there had been a “civic coup”.
“I am sending my resignation letter to the Legislative Assembly of Bolivia,” he said.
“I ask you to stop attacking the brothers and sisters, stop burning and attacking,” Mr Morales added.
He said it was his “obligation as indigenous president and president of all Bolivians to seek peace”.
Vice President Alvaro Garcia Linera also resigned.
People took to the streets in the capital La Paz and other cites after the announcement, waving flags, setting off fireworks and sounding their car horns.
Concerns were initially raised about the 20 October election after a day-long gap in reporting results, just before a spike in votes for Mr Morales.
The socialist president, who came to power in 2006 and was South America’s longest-serving leader, had already promised a fresh vote.
But the intervention of General Williams Kaliman and the publication of the OAS report appears to have forced his departure.
“After analysing the situation of internal conflict, we ask the president to resign, allowing peace to be restored and stability to be maintained for the good of our Bolivia,” said the military chief.
The European Union, the US, Brazil and the United Nations have all raised concerns about the election.
Former president Carlos Mesa, who was running against Mr Morales, called the result “a monumental fraud”, while Sunday’s preliminary OAS report said it had found a “heap of observed irregularities”.
Mr Morales, 60, was Bolivia’s first president from its indigenous population and helped lead an upturn in the country’s economy.
However, his bid for a fourth term as leader came after he refused to follow the results of a 2016 referendum supporting a limit on how long a president can serve.
According to Bolivian law, the head of the senate should take over as leader if there is no president or vice president.
Such a situation is only likely to be short-lived, until new elections are held.