Turkey is to release 38,000 inmates from its overcrowded prisons the country's Ministry of Justice has said, to make space for the thousands accused of taking part in July's coup to overthrow the government of Recep Tayyip Erdogan.

Justice Minister Bekir Bozdag announced the release of the 38,000 on Twitter. He explained the government's position was that the measure was not an amnesty or a pardon but a conditional release.

"The result of this arrangement in the first place indoor and outdoor penal institutions will be releasing approximately 38,000 people," he wrote on the social media platform.

The move will allow for the release of prisoners who have been convicted of non-violent crimes or crimes against the state, or have two years or less to serve on their sentences. Under the decree those not convicted of murder, domestic violence, sexual abuse, or terrorism and have served half their terms will be eligible for parole. All measures will only apply to crimes committed after 1 July, AP reported.

Ankara had previously refused to admit that there was a problem with Turkey's penal system. As more coup plotters were detained, pictures emerged online of alleged coup plotters handcuffed, stripped to their underwear and detained in sweltering rooms.

Metris prison
A Turkish gendarme patrols at the gate of the Metris prison Getty

The fact that 3,000 prosecutors and judges are among those who have been placed under arrest in the wake of the coup has made it even harder to process the accused.

Civil rights groups have expressed concern over conditions in the prisons. "In order to make space, they are piling people on top of each other," said Mustafa Eren, chairman of the Civil Society in the Penal System Foundations said on 5 August.

Turkey's prison population has exploded under President Tayyip Erdogan's AKP. There were 188,000 prisoners in Turkey as of March, already more than capacity. Some 35,000 people have been detained for questioning since July and more than 17,000 of them have been formally arrested.

On 16 August, Turkish police launched raids on 44 companies suspected of supporting Gulen – 120 company executives were detained as part of the sweep.