Prisons are meant for the guilty. But in Ukraine – where it is legal to hold someone in pre-trial detention for up to 18 months – they have become a convenient dumping ground for everyone from asylum seekers to once influential government officials.

From arrest to appeals, every step of the Ukrainian judicial system appears to be rife with human rights violations.

Car batteries, heavy books and handcuffs were among the items the Ukrainian Helsinki Human Rights Union displayed in an anti-torture demonstration last week outside of the General Prosecutor’s office in response to widespread reports of abuse at the hands of Ukraine’s police.

This week, two allies of opposition leader Yulia Tymoshenko – Anatoliy Makarenko and Taras Shepitko – were released after a year in pre-trial detention, and only after their lawyers argued that their health was deteriorating.

They were two of the most high profile of the almost 40,000 suspects being held in pre-trial detention in Ukraine as of last year.

Refugees receive similar treatment, including three Uzbek asylum seekers who have sat in crowded cells outside Kyiv for over a year awaiting extradition hearings. And it’s not just a matter of personal liberty.

Prisons are overcrowded, unsanitary and lack adequate medical facilities, according to the U.S. State Department’s most recent human rights report. In such conditions, simply waiting for a hearing can become a death sentence.

If anyone should be sympathetic it is Viktor Yanukovych. The President served two jail terms in Soviet days. But under his leadership, prison conditions remain abysmal while the ranks of those being held in protracted pre-trial detention grow.

Even when a suspect reaches a courtroom, conditions do not improve – as we have been seeing in Yulia Tymoshenko’s trial. Late last month, EU ambassador to Ukraine Jose Manuel Pinto Teixeira called the stifling conditions in the former Prime Minister’s courtroom “inhumane.”

And this is one of the best in Ukraine.

Ukraine claims to have EU aspirations, but its stance on human rights more closely resembles Russia, where journalists, businessmen and dissidents are often held for years without trial or are sentenced on extremely questionable grounds.

This week we were reminded of Sergei Magnitsky, a Russian lawyer who died in 2009 while in custody.

A Russian human rights panel this week argued that his death was the fault of investigators and prison officials and reported that he was severely beaten in prison. Government officials have maintained that Magnitsky died of heart disease.

If Ukraine wants to be respected as a democracy, it needs to clean up its criminal system on every level and ensure that only those truly guilty of crimes are treated as criminals. One obvious place to start is to minimize the circumstances and time suspects can be kept behind bars before trial.