Guatemalan ex-president Otto Perez attends a hearing at the Supreme Court in Guatemala City on September 3, 2015
Guatemala City (AFP) - Guatemala's Congress accepted president Otto Perez's resignation Thursday as he appeared in court over corruption allegations following unprecedented protests that have upended the political scene, three days from elections.
The retired general looked uncomfortable as prosecutors detailed their accusations before the Supreme Court, lowering his eyes when they played out wire-tapped phone calls they say implicate him in a scheme to defraud the state.
Investigators believe the 64-year-old conservative received $3.7 million in bribes paid by importers in exchange for illegal discounts on their customs duty, said prosecutor Antonio Morales.
Prosecutors have already charged his former vice president Roxana Baldetti, who resigned in May, with taking $3.8 million in bribes between May 2014 and April 2015.
Perez "was part of a criminal group in operation since May 2014 whose objective was to steal from the state," Morales said.
Thursday's hearing could see the fallen president remanded in custody pending trial -- a decision that would in any case have automatically removed him from office under Guatemalan law.
"I'm calm and I will face the situation bravely because I've done nothing wrong," Perez told a local radio station before his court appearance, where he sported a dark suit, red tie and a haggard look on his face.
- Veep to take office -
Congress meanwhile voted unanimously to accept Perez's resignation, which he submitted late Wednesday after the legislature stripped him of his presidential immunity -- a first in Guatemalan history.
Lawmakers then convened Vice President Alejandro Maldonado to be sworn in as head of state later Thursday.
Maldonado, a 79-year-old lawyer and former Constitutional Court judge, will hold power until an elected successor takes office on January 14.
The session was broadcast live on national television, riveting the country in the midst of a whirlwind week that had already seen the courts issue a travel ban and arrest warrant for Perez.
The embattled president stepped down after clinging to power through months of mounting protests.
Guatemalans fed up with corruption erupted in celebration outside the Supreme Court early Thursday on the news of his resignation.
"Otto, you thief, you're going to Pavon!" they chanted, referring to one of the country's main prisons.
Thousands have hit the streets in protest since the scandal first erupted in April, on a scale never before seen in Guatemala.
The accusations have stoked outrage in the Central American country of 15 million people, 53.7 percent of whom live in poverty, where the scars are still fresh from a 36-year civil war that ended in 1996.
The scandal was uncovered by investigators from a United Nations commission tasked with fighting high-level graft in Guatemala, who say they found massive evidence that Perez orchestrated a scheme dubbed "La Linea" (The Line), named for the hotline that importers would allegedly call to access a network of corrupt officials.
Investigators say their accusations are based on 89,000 wire-tapped phone calls.
Perez, a former military intelligence officer, long rejected calls to resign before his term ended. In office since 2012, he was ineligible for re-election and would have handed over to his successor in January.
But his increasing isolation and the justice system's relentless pursuit ultimately left him little choice.
- Tensions ahead of election -
The UN investigative commission has also uncovered separate corruption schemes implicating the heads of the central bank and social security administration, leading to their arrests.
The climate in Guatemala is jubilant but tense heading into Sunday's elections, which will also choose the members of the 158-seat legislature and 338 mayors.
The UN warned Wednesday there was a risk of violent protests on voting day.
Rights groups have reported cases of political party activists attacking protesters, and some 10 candidates were murdered between March and August.
In a sign of Guatemalans' exasperation with politics as usual, a poll published Thursday found the leading candidate in Sunday's presidential vote is now actor Jimmy Morales, whose previously underdog campaign is his first foray into politics.
The poll gave Morales 25 percent support, ahead of the former frontrunner, right-wing lawyer Manuel Baldizon (22.9 percent), and former first lady Sandra Torres (18.4 percent).
The three candidates will likely battle it out for the two spots in a runoff on October 25.