A Guatemalan judge has ordered former President Otto Perez Molina held in jail overnight during a court hearing on corruption allegations that led him to resign, though his attorney is appealing the ruling.
The judge says the decision aims to "ensure the continuity of the hearing."
No charges have been filed against the former president, who denies any wrongdoing.
Perez Molina's attorney protested that the measure was unnecessary because the former president has appeared voluntarily before the court.
His successor, Alejandro Maldonado, was sworn in Thursday afternoon.
Guatemalan Congress accepts president's resignation
Guatemala's newly sworn-in president demanded that all top government officials submit their resignations and promised an honest and inclusive administration following the surprise resignation earlier Thursday of President Otto Perez Molina amid a widening fraud investigations.
President Alejandro Maldonado reached out to protesters who took to the streets against the country's entrenched corruption, promising he would "leave a legacy of honesty" and restore faith in Guatemala's democracy in his brief few months in office.
"You can't consider your work done," Maldonado said in remarks aimed at all those demanding change. "In what is left of this year, there must be a positive response."
The unprecedented political drama played out after a week in which Perez Molina was stripped of his immunity, deserted by key members of his cabinet, and saw his jailed former vice president ordered to stand trial. All this just days before Sunday's election to choose his successor.
As Maldonado took office, Perez Molina was in court hearing accusations that he was involved in a scheme in which businesspeople paid bribes to avoid import duties through Guatemala's customs agency. He is the first Guatemalan president to resign and it was not immediately clear whether he would be detained.
The retired military general insisted upon his innocence in an interview with The Associated Press during a break in the court proceedings, saying the process had been "very hard, very difficult."
He said he could have derailed the investigation, but didn't.
"I had things I could have done," Perez Molina said. "I could have replaced the prosecutor, I could have dug in."
Attorney General Thelma Aldana told reporters she will ask that Perez Molina, 64, be jailed during the court proceedings.
Analysts say the resignation was a key blow to corruption in the country and a boost for the rule of law.
"In the midst of this political crisis there is interesting and good news," said Eric Olson, a Central America expert at the Washington-based Wilson Center. "The attorney general resisted strong pressures and even asked for the president to be incarcerated ... that shows the institutions inGuatemala under the right circumstances can operate and be effective."
Maldonado, a 79-year-old conservative former high court justice, has served as Guatemala'sforeign minister and in ambassadorial posts. He also formerly headed Guatemala's highest court, where he presided over much-debated decisions like the one not to extradite former dictator Efrain Rios Montt.
Rios Montt faced charges in Spain for genocide, torture and terrorism committed at the height ofGuatemala's 1960-1996 civil war, and the decision against extradition was hotly criticized.
Upon taking office Thursday, Maldonado said he was going to "form a transition government and invite all the social groups that are protesting in the streets to propose young professionals to form the new administration."
Earlier in the day, Perez Molina gave an interview to a local radio station, saying that he doesn't "trust Guatemalan justice" and criticizing the nation's prosecutors and the United Nations commission against impunity that have mounted a huge investigation in the fiscal fraud case he was implicated in.
He said the case was built by them to "seek prominence" and "to fill their egos."
The corruption scandal, uncovered by prosecutors and the U.N. commission, involved a scheme known as "La Linea," or "The Line," in which businesspeople paid bribes to avoid import duties through the customs agency. The ring is believed to have defrauded the state of millions of dollars.
Ex-Vice President Roxana Baldetti's former personal secretary was named as the alleged ringleader and is a fugitive. She resigned May 8 because of the same scandal and is now jailed and facing charges. She also maintains her innocence.
A growing protest movement brought together Guatemalans from all walks of life demanding that Perez Molina step down. Business leaders and even Catholic church officials had called for him to resign in recent weeks as the investigation of the customs fraud ring has grown wider and hit more officials.
Perez Molina was steadfast in his plan to stay until the judge's unprecedented order, only deciding to resign in the middle of the night.
His spokesman told reporters the president submitted his resignation "to maintain the institution of the presidency and resolve on his own the legal proceedings leveled against him."
Perez Molina was elected in 2011 on a platform of cracking down on crime. He is a retired general who participated in the country's 36-year bloody civil war, and later in the march toward peace. His critics say he also took part in the mass killings of civilians, but he has never been charged with anything.
His election as president had worried leftist groups and human rights organizations because of the military's past control of the government. But Perez Molina has been a political moderate who has kept the military at arm's length, proposing at one point to legalize drugs to rid his country of the scourge of cartels and trafficking.
Maldonado will likely remain in office until the winner of upcoming elections is inaugurated Jan. 14, 2016. The first round is on Sunday, pitting a wealthy businessman and politician against 13 other candidates, including a comedian with no political experience, a former first lady and the daughter of an ex-dictator accused of genocide. If none of the candidates reaches 50 percent, a runoff will be held Oct. 25.
Protesters filling the streets have also demanded that Sunday's presidential elections be postponed. Perez Molina, who was not on the ballot, has said delaying the vote would be against the law.
The U.N.'s commission against impunity said in a report released in mid-July that the country's elections are rife with illegal money, and corruption is the glue holding the system together.