As Panama reels from outrage at legal loopholes that help the world's wealthy hide their cash, inmates at the capital's La Joya prison are paying a heavy price for flaws elsewhere in the Central American nation's justice system.
Housed in makeshift cells because of heavy overcrowding, living in grimy conditions and with limited medical attention, many prisoners languish for years without being sentenced.
A 2014 report by Open Society Foundations found Panama had the world's highest pre-trial detention rate as a percentage of the country's wider population.
"There is no limit to pre-trial detention" in practice, said Juan Carlos Arauz, a Panamanian lawyer and vice president of the National College of Lawyers. He said more than 60 percent of the prison population has not been sentenced.
Under rules being phased out by September, pre-trial detention was limited to the minimum sentence for which a detainee could be liable for a given crime. But in practice, authorities have not always complied.
In the new system being implemented, pre-trial detention will be capped at one year and detainees can apply for bail, with any time served in pre-trial detention counting toward their eventual sentence.
Panama was thrust into the limelight earlier this month when documents leaked from a local law firm exposed offshore financial dealings of the world's rich and famous.
Since then, France has said it will blacklist Panama, Iceland's prime minister has stepped down over the revelations and Panama's government has vowed to share tax information with other nations to prevent evasion.
But problems with Panama's legal system run much deeper.
Prisons have sometimes "life-threatening" conditions, according to a 2014 report by the U.S. State Department, which cited deadly prison fights and too few guards.
"The only thing I want is to be handed my sentence," said Alvis Javier, a Panamanian who has been imprisoned without a conviction for six years in La Joya, on the outskirts of Panama City, for suspected drug possession.
Javier is studying for a secondary school certificate and lives in a cell in the prison's transgender unit, where inmates draw curtains over their bunks for privacy.
Carlos Fuentes, who was jailed for falsifying his ID card, has been stuck in La Joya, Spanish for "The Jewel," for almost two years awaiting sentencing.
"There are a lot of us here in this situation," he said.
The government has been moving foreign prisoners to a new prison, La Nueva Joya, to cut down on overcrowding, prisoners said.
Gabriel Pinzon, director of Panama's prisons system, said the cellblock at La Joya that foreign prisoners have vacated would be repaired and remodeled.
"We see some factors related to the volume of cases, which at times impacts the judicial [process], which we are currently trying to combat," he added, referring to pre-trial detention times.
A reform approved in 2008, which takes effect in Panama's major urban areas in September, will give defense attorneys a more equal playing field and will limit pre-trial detention to up to a year, Arauz said.
However, inmates detained under the prior system will have to have their cases processed under the old rules, he noted.
Nevertheless, the new rules will eventually help cut down on overcrowding and pre-trial detentions, Arauz said, pointing to parts of Panama where they have already been implemented.