Guatemalan President Otto Perez Molina stepped down late Wednesday in the face of a major corruption scandal, his office announced, according to The Associated Press.

Perez Molina is being investigated for bribery, fraud and illicit association. A judge on Wednesday granted a request from the attorney general for the president to appear in court for testimony.

Perez Molina was stripped of presidential immunity on Wednesday, and could face jail time if found guilty. Former Vice President Roxana Baldetti, who resigned in May, has been detained and is awaiting trial. Several other officials in his government have already resigned.

Prosecutors, who were working jointly with the UN, alleged that Perez Molina and other government officials took bribes from companies in exchange for lower tariffs.

The president has denied any wrongdoing.

His resignation comes days before Guatamala's presidential election. Perez Molina was not running.

News of the fraud ring sparked months of protests and calls for Perez Molina to resign. As The New York Times reported, the Roman Catholic Church even urged him to step down.