Panamanians have taken to the streets to protest against high levels of corruption.
The former president of Panama’s supreme court, Alejandro Moncada, has pleaded guilty to charges of illicit enrichment.
Moncada was suspended from his post in October when he came under investigation by Panama’s Congress.
He also pleaded guilty to falsifying documents and was sentenced to five years in detention.
Moncada was appointed by former President Ricardo Martinelli, who himself faces a corruption probe.
As part of the deal struck with prosecutors, Moncada will hand back two apartments worth a total of $1.7m (£1.1m) he had bought since coming to office.
Crackdown on corruption
Shortly after taking up his position in 2010, Moncada had declared only a gold watch and a 2005 Toyota van. He also said at the time that he had no other income apart from his judge’s salary.
Moncada’s lawyer said his client’s health was deteriorating and he had therefore agreed to plead guilty to two out of the four charges against him.
He was also facing allegations of money laundering and corrupting officials.
It has not yet been decided whether Moncada will be sent to jail or whether he will be allowed to serve his sentence under house arrest.
Moncada is one of a series of officials to face corruption probes since President Juan Carlos Varela came to office on a promise to clean up Panamanian politics.
Last month, the supreme court voted to investigate Mr Varela’s predecessor in office, Ricardo Martinelli, over allegations he had inflated multi-million-dollar contracts.
Mr Martinelli denies the allegations.