Guatemala’s former President Otto Pérez Molina, center, attends a court hearing to face corruption charges. Photograph by Saul Martinez/Bloomberg via Getty

Otto Pérez Molina, who resigned as the President of Guatemala on Wednesday, spent Thursday morning in a Guatemala City courtroom, where the Public Ministry formally charged him with “being part of a criminal organization, with the purpose of defrauding the state.” From the courtroom, he was escorted to a military prison. Prosecutors claim that, along with former Vice-President Roxana Baldetti, Pérez Molina received fifty per cent of the profits of a customs-fraud operation, known as La Linea, that was run by government officials. Baldetti resigned in May, after the first arrests were made, and is also in jail awaiting trial.

In the courtroom, the former president listened to dozens of phone calls, recorded by state prosecutors, in which customs officials agreed to charge importers reduced rates at ports and borders. In images of the hearing, broadcast on TV, he looked stiff, and gazed downward. Guatemalan television also showed hundreds of citizens gathered outside the court, some enveloped in flags, celebrating. The investigation, which drew on more than sixty thousand wiretapped phone calls and thousands of e-mails, was a joint operation of the attorney general’s office and the U.N. International Commission against Impunity in Guatemala, or CICIG.

General elections are scheduled for this Sunday, September 6th, but it’s unclear if they will be held. (Pérez Molina was not eligible to run due to term limits.) Yesterday, as Pérez Molina prepared to spend his first night in prison, Vice-President Alejandro Maldonado was sworn in as his interim replacement.

Last Thursday, after prosecutors announced the charges, an estimated hundred thousand people packed Guatemala City’s Plaza Central to demand Pérez Molina’s resignation, and thousands more marched throughout the country. The powerful business association Cacif called for a general strike to support the protests, and the daily newspaper El Periódico ran the popular hashtag #YoNoTengoPresidente (I Don’t Have a President) as a front-page headline. In one of his last, desperate moves to remain in power, Perez Molina accused CICIG of serving foreign interests, claimed to be innocent of the charges, and asked rural Guatemala, “the deep Guatemala,” to take the streets and show its support for him. His call was answered by Thursday’s protest against him, the largest of twenty peaceful protests that had been held since the fraud scheme was disclosed in April.

A month after Pérez Molina took office, in February, 2012, I met him at a small conference organized in Guatemala City by the Washington, D.C. think tank Inter-American Dialogue. A former general, he was Guatemala’s first military president in three decades, and although he entered office with only the cautious support of the international community, he soon earned its respect. He appointed prominent members of civil society to his cabinet, embraced previously abandoned rural populations, and extended the mandate of CICIG. He promised to combat drug cartels, but also spoke about legalizing drugs in Guatemala.

At the conference, he was wearing an elegant blue suit—not your standard Central American military fashion—and told Guatemalan and other regional businesspeople that he believed they should be paying more taxes. He also described a plan to fight organized crime and corruption, with the support of Attorney General Claudia Paz y Paz and CICIG. Afterward, a Salvadoran businessman told me, “This is the kind of leader Central America needs—an honest, strong man, sensitive to social needs, but with a strong hand against organized crime. With a President like him, I would be glad to pay my taxes.”

Guatemala was at that time in the midst of undertaking a comprehensive reform of the security and judiciary institutions, overseen by CICIG. A few years earlier, the national-security system had collapsed under the weight of drug cartels and corruption. In February, 2007, three Salvadoran congressmen had been found murdered near Guatemala City, and four police officials had confessed to killing them on behalf of a drug-smuggling ring; they had received a message that the congressmen were transporting drugs for a rival cartel. A few days later, the arrested officers were killed inside Guatemala’s maximum-security prison.

The scandal prompted the resignations of the police director and the security minister. CICIG started operating a few weeks later, but officials soon realized that the organization would accomplish little unless it purged both the attorney-general’s office and the police department. Perez Molina’s predecessor, President Álvaro Colom, found hidden cameras and microphones in his office: his own security personnel were spying on him.

Claudia Paz y Paz, a lawyer with a long career in human-rights work, was appointed attorney general in 2010. With the help of CICIG, she started dismissing prosecutors with dubious records. Since Paz y Paz started her work, more than thirty drug rings, gang cliques, and other criminal operations have been dismantled, and more than a hundred public officials have been charged with crimes.

When I met Paz y Paz, in 2012, she was extraditing high-level drug dealers to the United States. She had been receiving death threats, and I had to go through several security checks to reach her office in downtown Guatemala City. I asked her if, given the fact that these drug barons had committed crimes in Guatemala, sending them to the United States was an admission that the Guatemalan system was too weak to deal with them. “Of course, that’s exactly what it is,” she told me.

Helen Mack Chang, a human-rights activist who was appointed to direct a government commission for police reform, says that Paz y Paz brought systemic change to the attorney-general’s office. “Instead of investigating crimes one by one, from an endless pile of files, she started investigating the structures, the criminal organizations. She reorganized the whole process.”

In 2013, government prosecutors, with the help of human-rights lawyers, attempted something unprecedented: they accused former military dictator Efraín Rios Montt of genocide against the Ixil, a Mayan people who are indigenous to Guatemala, on the grounds that his troops had killed almost two thousand Ixil and displaced some thirty thousand of them. As dozens of indigenous people testified before the court, the trial came to be about more than Ríos Montt’s responsibility; it took on all of the abuses that the Guatemalan military and wealthy landowners inflicted on the indigenous population during the dirty war of the early nineteen-eighties. One of the witnesses, a former Army mechanic named Hugo Leonardo Reyes, who was assigned to the Ixil areas during the Rios Montt dictatorship, testified that the commander in charge of the local military garrison had burned down villages and ordered the execution of Ixils. The name of the local commander, he said, was Otto Pérez Molina.

President Perez Molina immediately denied the accusations and blamed Judge Yassmin Barrios for putting Guatemala’s political stability at risk by allowing witnesses “to tell such damaging lies.” Conservative media pundits, who deny any racism in the structure of Guatemalan society, unleashed an aggressive campaign against the trial, denying that there was genocide and stating that, if war crimes were ever committed, they should be judged in the context of the Cold War, in which the Army was fighting Communist aggression. After weeks of testimony and deliberations, Judge Yassmin Barrios found Rios Montt guilty. Later, the Supreme Court annulled the conviction on a technicality and suspended Judge Barrios for a year. The Supreme Court also shortened the term of the attorney general, Paz y Paz. She was not reëlected. Pérez Molina announced his intention not to renew the CICIG’s mandate.