The president of Guatemala, Otto Perez, has been jailed just hours after he resigned from his position amid a corruption scandal that has seen mass protests on the country’s streets.
Perez was escorted into custody after being deemed a flight risk while a judge weighs up whether to charge him with corruption.
In an emergency session, Congress approved Perez’s resignation after the retired general quit overnight.
Former vice president, Alejandro Maldonado, was sworn in as president to fill out the remaining months of Perez’s term.
Tens of thousands of protesters had flooded the streets of the capital, Guatemala City and other cities in recent weeks, calling for Perez to step down over allegations he was involved in a customs racket.
Celebrations over Perez’s resignation erupted in a plaza of the capital on Thursday, as the country prepared for presidential and congressional electionson Sunday.
Perez told reporters before being escorted away: “I am going to respect due process and face this. I believe this is completely inconsistent.”
Perez, 64, has repeatedly denied any wrongdoing.
In his resignation letter, submitted to Congress on Thursday night, Perez said he would face the charges against him ‘with a clear conscience.’
Prosecutors allege he was involved in a customs scam dubbed ‘La Linea’ (The Line), referring to a phone hotline used by importers to avoid paying customs duties in exchange for bribes.
Prosecutors have said the charges to be brought against Perez are illicit association, taking bribes and customs fraud, but he has not yet been charged
Dressed in a dark suit, Perez sat in the courtroom while prosecutors played phone recordings that allegedly implicate him in the scandal.
Perez was elected in late 2011 after promising to fight crime and corruption. Under Guatemala’s constitution, he was not allowed to seek re-election inSunday’s presidential vote.
He had resisted calls for his resignation but his options narrowed on Wednesdaywhen lawmakers stripped him of immunity from prosecution and a judge issued a detention order against him.
Attorney General Thelma Albania said Perez was also being investigated for money laundering, which could lead to the freezing of his assets.
His conservative government spent much of this year facing corruption allegations, and he fired several of his cabinet members in a purge in May.
Former Vice President Roxana Baldetti resigned after she was linked to ‘La Linea.’ She denied any wrongdoing but was arrested on the same charges Perez now faces.
More than 20 other officials, including the president of the central bank, have been arrested over the scam, though how much money was involved is still unclear.
Prosecutors and a powerful UN-backed anti-corruption body known as the CICIG moved against Perez following months of investigations and findings taken from some 89,000 telephone taps, almost 6,000 emails and 17 raids.
The anti-corruption investigations have also hit the center-right opposition Lider party, whose election candidate, Manuel Baldizon, had been leading the polls.