Bolivian president Evo Morales has announced his resignation amid unrest over a disputed election he had claimed to win.

The leader faced mounting pressure to resign after the Organisation of American States (OAS) found “serious irregularities” in the 20 October presidential electi​on vote.

Mr Morales said he was stepping down “for the good of the country”, according to reports.

His resignation came hours after the head of the country’s military called on Mr Morales to step down, while appealing to Bolivians to desist from violence.

Mr Morales declared himself the outright winner after last month’s vote, even before official results indicated he had gained just enough support to avoid a runoff with opposition leader Carlos Mesa.

Police abandon posts to join Bolivia protests Show all 15 1 /15 Police abandon posts to join Bolivia protests Police abandon posts to join Bolivia protests People protest against Bolivia's President Evo Morales in La Paz Reuters Police abandon posts to join Bolivia protests Police officers standing on the rooftop of a security booth at a police station wave Bolivian flags AP Police abandon posts to join Bolivia protests Protesters cheer at police officers Reuters Police abandon posts to join Bolivia protests Supporters of President Evo Morales clash with a bus caravan that was heading to La Paz to march against the government EPA Police abandon posts to join Bolivia protests A police officer waves a national flag on top of a police station during a protest against Bolivia's President Reuters Police abandon posts to join Bolivia protests Police officers, who have joined a rebellion, take part in a march to protest against the government AFP via Getty Images Police abandon posts to join Bolivia protests Demonstrators with makeshift shields protest against President Evo Morales AP Police abandon posts to join Bolivia protests Police officers, who have joined a rebellion, take part in a march AFP via Getty Images Police abandon posts to join Bolivia protests A wounded person who was heading to La Paz to join a march against the president EPA Police abandon posts to join Bolivia protests Citizens cheer the bus caravan that was attacked while heading to La Paz in support of marches EPA Police abandon posts to join Bolivia protests epaselect epa07984177 Policemen wave the tricolor flag of Bolivia while they retreat to a police station in the city of Santa Cruz, Bolivia, 09 November 2019. Several Bolivian Police units have mutinied in various parts of the country in disagreement with the actions of President Evo Morales over the crisis that Bolivia is going through since the last elections, as he defends his victory at the polls against the allegations of fraud from opposition and civic committees who do not recognize the president's victory for a fourth consecutive period, and demand his resignation and that new elections be called. EPA/Juan Carlos TorrejÃ³n Juan Carlos Torrejón EPA Police abandon posts to join Bolivia protests A motorcycle on fire on a road leading to La Paz, EPA Police abandon posts to join Bolivia protests Anti-government protesters against the reelection of President Evo Morales gather just meters away from the presidential palace AP Police abandon posts to join Bolivia protests A person is treated EPA Police abandon posts to join Bolivia protests epa07985138 Citizens cheer the bus caravan that was attacked while heading to La Paz in support of marches against the President of Bolivia Evo Morales, as it returns to Oruro, Bolivia, 09 November 2019. A caravan of buses that was heading to La Paz in support of marches against the President of Bolivia, Evo Morales, was attacked on a highway in the Andean area, in an incident in which an undetermined number of wounded. The buses came from the regions of Potosi and Chuquisaca, in the west and south of the country, and suffered an attack after leaving for La Paz in the morning after stopping at night in the Andean city of Oruro. EPA/EMILIO CASTILLO EMILIO CASTILLO EPA

Questions were raised when an official fast count by the Supreme Electoral Tribunal abruptly stopped in the evening after the vote, with almost 84 per cent of the count complete.

At that point, it showed Mr Morales and Mr Mesa heading to a second round.

However after a near 24-hour pause to the count, the data was updated the following evening, this time showing Mr Morales with more than a 10-point lead, handing him an outright victory.

The OAS report on Sunday declared there were irregularities, “serious security flaws” in the computer systems and “clear manipulation” of the count, which called the into question Mr Morales’ victory.

Image released by Boliva’s Presidency showing the house of Bolivia’s Ministry of Mining and Metallurgy, Cesar Navarro, burning after protesters set it on fire demanding his resignation on 10 November, 2019. (Bolivian Presidency/AFP via Getty)

His re-election triggered weeks of unrest which left three people dead and more than 100 injured in clashes between his supporters and opponents.

Just minutes after the 60-year-old socialist leader stepped down, vice president Alvaro Garcia Linera also resigned, followed by senate president Adriana Salvatierra.

Two government ministers, the Chamber of Deputies president and three other pro-government legislators also quit earlier in the day.

Mining minister Cesar Navarro and Chamber of Deputies president Victor Borda both cited fear for the safety of their families as their reason for stepping down.

The head of Bolivia’s Supreme Electoral Tribunal also stepped down after the OAS findings were released, and the attorney general’s office said it will investigate judges on the tribunal for alleged fraud.

Mexican foreign minister Marcelo Ebrard offered Mr Morales asylum, adding that Mexico had received 20 Bolivian officials at its official residence in La Paz.

The country’s president Andres Manuel Lopez Obrador wrote on Twitter that the Mexico ”recognised the responsible attitude of the president of Bolivia, Evo Morales, who preferred to resign rather than to expose his people to violence”.

Venezuelan president Nicolas Maduro also condemned a “coup” against his leftist ally Mr Morales, adding in a Twitter post: “We categorically condemn the coup realised against our brother president.”

Mr Morales was the first member of indigenous population to become president and was in power for 13 years and nine months, the longest term in the country’s history.

He ran for a fourth term after refusing to abide by the results of a referendum that upheld term limits for the president. He was able to run because Bolivia’s constitutional court disallowed such limits.

During the unrest, protesters torched the headquarters of local electoral tribunal offices and set up roadblocks that paralysed parts of Bolivia.

Pressure on Mr Morales increased on Saturday when police on guard outside Bolivia’s presidential palace abandoned their posts and police retreated to their barracks in at least three cities.

In a statement on Sunday, the leader said: “I am sending my resignation letter to the Legislative Assembly of Bolivia.

“I ask you to stop attacking the brothers and sisters, stop burning and attacking.”