Guatemala's Otto Pérez Molina spends his first night as ex-president in jail

Former President of Guatemala Otto Perez Molina, center, is escorted by police detectives on his way to jail, after a court hearing where he faces corruption charges, in Guatemala City, Thursday, Sept. 3, 2015. Perez Molina was detained overnight before the hearing was to resume Friday morning. Judge Miguel Angel Galvez cited a need to âensure the continuity of the hearingâ and guarantee the former presidentâs personal safety. (AP Photo/Luis Soto)

GUATEMALA CITY (AP) – Otto Pérez Molina spent his first night as an ex-president in military custody following a historic day in which he resigned and Guatemala's Congress swore in Vice President Alejandro Maldonado to serve the remainder of his term.

The judge hearing a corruption and fraud investigation against Pérez Molina ordered the former president held in custody until the hearing reconvened Friday morning. Pérez Molina left the court under heavy police guard and was later seen entering a military barracks in the capital.

Shortly after taking the oath of office Thursday, Maldonado demanded that ministers and top officials submit their resignations so he could form a transition government and promised an honest and inclusive administration.

Reaching out to protesters who took to the streets against the country's entrenched corruption, he vowed to 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 was the climax of a week in which Pérez Molina was stripped of his immunity from prosecution, deserted by key members of his Cabinet and saw his jailed former vice president ordered to stand trial — all just days before Sunday's election to choose his successor.

Pérez Molina appeared in court Thursday to face 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.

Judge Miguel Angel Galvez ordered Pérez Molina's detention citing a need to "ensure the continuity of the hearing" and guarantee the ex-president's safety.

Pérez Molina, 64, has steadfastly maintained his innocence and reiterated his willingness to face the investigation head-on.

"I have always said I will respect due process," he said. "I do not have the slightest intention of leaving the country."

Earlier he told the Associated Press during a break in the court proceedings that the process had been "very hard, very difficult," and that he could have derailed the probe but did not.

"I had things I could have done," Pérez Molina said. "I could have replaced the prosecutor, I could have dug in."

Uncovered by prosecutors and a U.N. commission known as CICIG, which is investigating criminal networks in the country, the customs corruption scandal involved a scheme known as "La Linea," or "The Line." It is believed to have defrauded the state of millions of dollars.

A growing protest movement brought together Guatemalans from all walks of life, from business leaders to Roman Catholic Church officials, to demand that Pérez Molina step down as the fraud probe expanded to implicate more officials.

Ex-Vice President Roxana Baldetti's former personal secretary was named as the alleged ringleader and is a fugitive. Baldetti, who resigned May 8 and is now jailed and facing charges, also maintains her innocence.

Analysts said the events of the last few days have dealt a key blow to corruption in the country and boosted the rule of law.

"The main factor is the existence of CICIG working with the Guatemalan prosecutor to make the [prosecutor's office[ a strong and capable institution," said Cynthia Arnson, director of the Latin American Program at the Wilson Center in Washington.

"The popular protests were a product of the revelations of the last months, but without an independent body with real capacity to investigate and come up with evidence, we wouldn't see the same kind of scenario unfolding," Arnson said.

Heavy rains prevented the kind of mass public celebrations seen earlier this week when Congress lifted Pérez Molina's immunity of office. Some drivers honked horns, and scattered bands of young people lit firecrackers. Many in Guatemala City watched the former president being taken to jail on TVs in bars and stores.

"What they should have done with the president is send him to a common prison, where they would send me if I stole a carton of milk," said Agustín Monterroso, a 19-year-old sweets vendor who took cover from the deluge in the door to a restaurant. "And he should give back the money."

Maldonado, a 79-year-old conservative former high court justice, has served as Guatemala's foreign 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 Efraín Ríos Montt to face genocide, torture and terrorism charges in Spain.

Maldonado proposed three candidates to replace him as vice president: Raquel Zelaya, president of a conservative think tank and signatory to 1990s peace accords that ended Guatemala's civil war; Juan Alberto Fuentes Soria, a former university provost; and Gabriel Medrano, another academic and ex-Supreme Court president.

The shortlist will be sent to Congress on Monday.

Maldonado will likely remain in office until the winner of upcoming elections is inaugurated Jan. 14, 2016.

The U.S. Embassy in Guatemala said in a statement that it would work with the new president and congratulated the Central American nation for handling the crisis peacefully. U.N. Secretary-General Ban Ki-moon said he was aware of Guatemalans' desire to strengthen institutions and the rule of law, and called for calm during Sunday's election.

The first round pits a wealthy businessman and politician against 13 other candidates, including a comedian with no political experience, a former first lady and the daughter of Ríos Montt, who now faces a genocide trial in his home country. If none of the candidates gets 50 percent of the vote, a runoff will be held Oct. 25.