Organised gangs - so ubiquitous in Brazilian jails that many experts believe criminals virtually run the country's prison system - are blamed for the current rioting and unrest in Sao Paulo state.
Attacks were launched inside and outside jails across Sao Paulo state
One of the most prominent of them is the First Command of the Capital (PCC), which has grown and evolved into what experts say is a formidable criminal organisation, displaying a high degree of co-ordination, integration and management of its members.
It was formed in Sao Paulo by prisoners who survived one of Brazil's worst jail massacres in the early 1990s, when the police killed 111 inmates to put down a riot.
The group began as a kind of inmates' union, demanding better conditions in Brazil's brutal, overcrowded prisons.
The PCC gradually took control of many jails, using them as recruiting grounds.
The group is now heavily involved in drug and arms trafficking, kidnappings, and robberies - as well as prison riots.
The power of the PCC - both inside and outside prisons - has been heightened in recent years by the availability of mobile phones.
Gang leaders get phones smuggled through heavy prison security with the help of corrupt guards - and thus are able to run their criminal activities and issue orders from the safety of their cells.
Criminals have learned the language and organising methods of left-wing revolutionaries
Members pay monthly "dues" - 50 Brazilian reais ($23) for those behind bars, 500 reais ($230) for those who are out of prison.
Those who cannot pay are often ordered to carry out high-risk attacks on police officers to settle their debt, according to a report in the Folha de Sao Paulo newspaper.
The PCC, like its counterpart, the Comando Vermelho or Red Command in Rio, organises funk music parties in Sao Paulo's shanty towns where songs exalting the gang are played.
In 2001, the PCC was believed to have been behind riots launched simultaneously at 24 prisons across Sao Paulo state.
Uprisings have continued unabated. In June 2005 the PCC spearheaded a revolt at a notorious detention centre north-west of Sao Paulo - shortly before it was pulled down.
The mutineers overpowered guards and killed five fellow inmates, whose decapitated heads were waved from the prison's roof.
Since the start of 2006, the state authorities say the PCC has orchestrated rebellions in dozens of prisons. According to a wardens' union, more than 460 guards have been taken hostage.
The latest attack occurred on 13 May, when a wave of unrest both on the streets and inside 18 prisons across the state left at least 30 dead. Most of the victims were police officers.
Officials said the attacks were the PCC's response to the decision of the state government's move to isolate its leaders in different prisons.
Fuel to fire
Co-ordination between gang members is not just the result of technological innovation.
BBC regional correspondent Tom Gibb says that during the military dictatorship that ruled Brazil until 1985, criminals learned the language and organising methods of left-wing revolutionaries with whom they shared prison cells.
Crime and politics appear to mix in Brazilian jails
The same merging of criminal and political activities has been observed in other Latin American countries.
In Colombia, Peru and Central America left-wing guerrillas were able to organise and recruit inside prisons during the 1980s.
Today jails across Central America are filled with members of street gangs.
Once again, many warn that hard-line government policies in countries like El Salvador - with long jail sentences for simply belonging to a gang - are backfiring.
The prisons, far from resolving the problem of organised crime, may be adding fuel to the fire, our correspondent says.