By Becky Branford
BBC News Online
"I've been in prisons all around Brazil," said James Cavallero, founder of Brazilian human rights group Global Justice.
Brazil's frequent prison revolts are blamed on poor conditions
"They're dark, dreary, wet, and damp. Some of them feel like mediaeval dungeons. And it's remarkable - there's the same stench in all of them. Rotting food, urine, excrement, prisoners' sweat. That prison smell is uniform - it's teeming humanity."
Both the government and rights groups agree that poor conditions in Brazilian jails are a critical factor in the country's notorious record of regular uprisings - which all too often end in blood and death.
One of the main factors is overcrowding.
According to the Ministry of Justice, Brazil's prison population grew 84% between 1995 and 2003, as governments eager to crush the crime wave tearing through Brazilian cities encouraged the justice system to get suspects behind bars.
Amnesty International estimates that a system with a capacity for 180,000 inmates is now holding at least 285,000. It condemned conditions in Brazilian detention facilities as "cruel, inhuman or degrading".
"It's terrible," Mr Cavallero told BBC News Online.
"You see cells built for four people, with four sleeping racks, and there are 20 or 25 people in there that have to rotate to sleep."
But overcrowding is not the only problem.
Facilities offer little sanitation, and are badly built. In a recent uprising at the Benfica detention facility in Rio de Janeiro, reporters were shocked to see prisoners easily pounding holes into the walls so they could attract the attention of relatives outside.
Long wait for trial
Rights groups add that prison system is poorly planned.
This problem is particularly acute at the so-called "entry point" to the prison system, they say.
Swelling numbers of suspects arrested by police are kept in police "lock-ups" and facilities where they wait for months - and sometimes even years - to be tried.
With the constant passage of suspects through the facility, and the continual arrival of new suspects, it is difficult for authorities to order and segregate detainees according to the severity of their crime and their background.
1992: 111 inmates die after police storm Carandiru prison in Sao Paulo
2001: In a simultaneous state-wide rebellion, prisoners revolt at 29 different facilities
2002: 10 people die and 60 prisoners escape during violence at the Embu das Artes jail in Sao Paulo
2003: 84 prisoners tunnel their way out of Silvio Porto prison in Paraiba, in the biggest breakout in Brazil's history
April 2004: 14 inmates are killed, some mutilated, during an uprising at Urso Branco prison in Rondonia
June 2004: An uprising at Benfica facility in Rio leaves at least 34 inmates dead
This can mean detainees with contagious diseases mix freely with other detainees - what Mr Cavallero terms the "Petri-dish effect" - and it poses a particular threat when it comes to detaining members of Brazil's urban drugs gangs.
In most prisons, Mr Cavallero said, gangs would be kept separate at all times to avoid confrontations.
But in temporary facilities, little effort is made to keep them separate - resulting in frequent, often fatal conflagrations.
Rights groups point out that this often exposes suspects who have not yet even been convicted of any crime to extreme overcrowding and the terrifying, daily threat of violence.
Paradoxically, they say, convicted prisoners often find they are living in much better conditions.
Federal v state responsibility
Brazilian authorities freely admit that problems are still rife.
A spokeswoman for the Brazilian embassy in London insisted the federal government was working to try to address the problems - but that the failure to improve lay with the state governments.
"According to the constitution, both the police and the prison system are dependent on each state government," Ana Perez told BBC News Online.
The federal government admits state police methods can be brutal
"There is a serious problem of the violation of rights and a series of abuses committed by the state police and in the state-level prison system and it depends on each state government.
She says the federal government is largely helpless if state authorities refuse to co-operate - but says things have got better in some states.
"The ministry of justice and the national secretary for human rights have been helping the state governors to improve the prison system," Ms Perez explained.
"For example, the state government of Sao Paulo has greatly improved the prison system... In the state of Rio, however, there has been no improvement."
Rights groups agree that some states have made efforts to better the situation, but bridle at the suggestion of the federal government that its hands are tied when it comes to forcing state authorities to make improvements.
They say the federal government should use some of its powers - even to the point of withholding federal funds - to compel state authorities to improve prison conditions.