Database: Prisons

At least seven prisons existed in Baghdad, holding anywhere from a few dozen to a few hundred prisoners each. Being condemned to spend time in any of these overpopulated jails was considered one of the worst forms of punishment possible, and there are multiple recorded examples of inmates begging to receive corporal punishments instead.
Most prisoners were debtors. The pressures of a life in prison were designed to make them pay what they owed to the State or to other individuals. Inside, they met all kinds of felons, from petty thieves to people convicted of public drunkenness. Criminal offenders were rarely held in prison, as most serious crimes (murder, treason, repeated blasphemy) were punished by death.
Some prisoners lived in awful conditions, but this depended on class and rank. Underpaid guards stole what they could from them, including the already insufficient rations of food and water awarded by the caliphal administration. Violence between detainees and the mass use of restraints which, for instance, prevented standing for prayer were other terrible aspects of life in an Abbasid jail. Women had their own jails, in which conditions were just as bad.
Worse still existed. Political and religious opponents that the caliphs dared not execute were often sent to the Mutbaq, a prison made of deep wells. There, they would await death in total silence and darkness.