CNN  — 

Bolivian President Evo Morales resigned Sunday amid growing opposition after an international audit found the results of last month’s election could not be validated because of “serious irregularities.”

Morales said he was stepping down “for the good of the country,” which has been roiled by protests in the days following the October 20 election. Three people have died in the protests and hundreds have been injured.

Calls for Morales’ resignation had grown over the weekend, and on Sunday, the head of the Bolivian Armed Forces, Cmdr. Williams Kaliman, asked Morales to step down in order to restore stability and peace.

Morales claimed he’d been forced out in a coup – a charge echoed by his allies in South America, but denied by the opposition movement, which said this was a fight for “democracy and peace.”

“I regret this deeply,” Morales said on national television. He will send his resignation letter to Congress in the next few hours, he said.

Demonstrators and the Bolivian opposition had accused electoral authorities of manipulating the vote count in favor of Morales, the country’s longtime socialist leader. Morales denied the allegations and declared himself the winner.

Morales was one of the longest-serving heads of state in Latin America. He served nearly 14 years and was Bolivia’s first indigenous president.

He won his first election with a campaign that promised a government focused on the needs of the country’s poor. But he was also accused of using the system to concentrate power.

“We have been in the government for 13 years, nine months and 18 days thanks to the unity and the will of the people,” Morales said in a statement posted to Twitter. “We are accused of dictatorship by those who lost to us in so many elections. Today Bolivia is a free country, a Bolivia with inclusion, dignity, sovereignty and economic strength.”

Celebrations broke out across the country as news of his resignation spread.

Who’s next in line

It was unclear Sunday evening who would be Bolivia’s next president. The officials next in the presidential line of succession all resigned Sunday.

Vice President Álvaro García Linera announced his resignation minutes after Morales stepped down.

President of the Senate Adriana Salvatierra Arriaza, 30, would have been next in line, according to the Bolivian Constitution. But she, too, announced her resignation Sunday evening.

The job would have passed to President of the Chamber of Deputies Víctor Borda, but he stepped down earlier Sunday.

Speaking to local media, the second vice president of Bolivia’s senate, Jeanine Añez, said that she is the next in line to assume the presidency, and is willing to do so.

Añez, an opposition lawmaker, said that she would assume the presidency with the objective of calling for new elections. But it remains unclear how the succession will unfold, or what role the military will play in the transition.

Bolivia's President Evo Morales during a press conference in La Paz, Bolivia, on Sunday, November 10, 2019.

How we got here

Morales did not plan to leave the country, he said Sunday. “I don’t need to escape. I want the people of Bolivia to know that I have not robbed anyone, nothing. If someone thinks we are stealing, then tell me. Present the proof.”

Morales resigned just hours after he promised new elections would be held and the country’s electoral council replaced following a report by the Organization of American States (OAS).

A series of alleged irregularities – including failures in the chain of custody for ballots, alteration and forgery of electoral material, redirection of data to unauthorized servers and data manipulation – impacted the official vote count, the OAS said.

In the hours after polls closed, preliminary results showed Morales slightly ahead of his opponent, former President Carlos Mesa. The tight margin would have prompted a runoff vote in December.

But the opposition and international observers became suspicious after election officials stopped the count for about 24 hours without an explanation. When the count resumed, Morales’ lead had jumped significantly.

People protest election results in Sucre, Bolivia, on October 22, 2019.

“The manipulations to the computer system (used in the elections) are of such magnitude that they must be deeply investigated by the Bolivian State to get to the bottom (of this issue),” the OAS said, in part.

The organization recommended new elections be held under the umbrella of “new electoral authorities in order to offer a reliable process.”

Saturday, various police units joined those calls, while Kaliman, the head of the Bolivian Armed Forces, said his units would not confront protesters.

A number of other government officials resigned Sunday, including the president and vice president of the electoral council, known as the Supreme Electoral Tribunal.

By Sunday night, both of them had been arrested for “electoral crimes,” according to Bolivia’s state-run ABI news agency.

The prosecutor’s office opened an investigation into allegations of falsifying documents, manipulating data and alternating results, among others, the news agency reported.

In her letter, Maria Eugenia Choque, president of the electoral tribunal, said she was resigning with the “firm conviction that I have not taken any actions to alter the sovereign will of the Bolivian people.”

The international community reacts

The US State Department is monitoring the “quickly unfolding events” in Bolivia, a US State Department spokesperson said. Earlier, US Secretary of State Mike Pompeo commended the OAS audit and said the United States supported the new election and the installation of a new electoral council.

“In order to to restore credibility to the electoral process, all government officials and officials of any political organizations implicated in the flawed October 20 elections should step aside from the electoral process,” Pompeo said.

But others, including Venezuelan President Nicolas Maduro and Cuban President Miguel Díaz-Canel Bermúdez, condemned what they called a “coup” against Morales.

“We condemn the opposition’s coup strategy which has unleashed violence on Bolivia, has cost deaths, hundreds of injuries and condemnable expressions of racism towards the native people,” Díaz-Canel said on Twitter.

Twenty members of the Bolivian executive and legislative branches have sought refuge at the Mexican ambassador’s residence in La Paz, said Mexican Foreign Minister Marcelo Ebrard.

Mexico would grant Morales asylum if he requested it, Ebrard added.

CNN’s Helen Regan and Matt Rivers contributed to this report.