By Henry Mance
Ciudad Barrios, El Salvador
Gang members sport elaborate tattoos as a sign of their allegiance
"There are four ways our officers can get themselves killed," says Major Gabriel Rodas, director of Ciudad Barrios prison in rural El Salvador.
"First, if they receive money from the prisoners as part of a deal and then they don't fulfil their side. Secondly, if they hit a prisoner. Thirdly, if they mistreat prisoners' visitors. And fourthly, if they have affairs with the prisoners' girlfriends."
These are not empty words. Since early last year, two prison guards at Ciudad Barrios have been killed.
Their deaths occurred away from the relative safety of the jail. But Major Rodas does not doubt that those ultimately responsible are among the inmates, all of them members of the Mara Salvatrucha gang - known as the MS.
"They activate their people on the outside by mobile phone. And the latter do the killing," he said.
The gang emerged in the 1980s, formed by Salvadoreans living in the United States. It quickly spread throughout Central America.
Over the past decade, US authorities have deported hundreds of members back to El Salvador, but the MS has used the policy to its own advantage, cementing transnational links for drugs trafficking and other activities.
El Salvador's own crackdown on the gang simply drove it further underground.
Today, nearly 7,000 gang members are currently behind bars in El Salvador, representing a third of the national prison population.
Card games help to pass the time in the overcrowded jail
However, as a tactic to weaken the MS and its rivals in the Pandilla 18 gang, jail sentences have been as ineffective as deportation.
Douglas Moreno, the recently-appointed head of the prison system, says the condition of the country's jails is totally unsatisfactory.
"The state has to look for solutions at once, not wait for them to appear by themselves," he said.
Part of the problem is the authorities' policy of dedicating certain prisons to one particular gang.
The idea is to avoid violence between rival groups, yet in practice it means the state has handed over control of the prisons to the gangs, argues Jeanette Aguilar, an expert on the topic at the University of Central America (UCA).
"The prisons have been the place where the gangs have moved towards institutionalising themselves. They have created criminal economic networks," she said.
Inmates at Ciudad Barrios happily refer to the prison as the MS's home or neighbourhood. Lack of supervision means prisoners can easily get hold of the phones they allegedly use to arrange murders and illegal deals.
The impact can be seen just a few hundred metres from the confines of Ciudad Barrios, in what seems like quiet, coffee-growing country.
Here, extortion by the prisoners is a daily reality. A local shop owner shows text messages demanding large, immediate payments and detailing her family's daily routine, in case she feels tempted not to comply.
She says she managed to negotiate the figure, but has already paid over $5,000 (£3,000, 3,500 euros) to the gang's enforcers in the town.
Such extortion payments are sometimes used to fund elaborate escape attempts from the prison.
In April, a tunnel being built from a nearby house into the jail was discovered. Some prison guards are now dedicated to surveillance of other houses suitable for such plots.
Two to a bed
It is hard to believe that, when it opened in 1999, Ciudad Barrios was meant to be a model prison for members of both the MS and the Pandilla 18.
But the experiment lasted only a few months, because MS prisoners savagely killed an inmate from the 18, crushing his skull with bricks taken from the latrines.
The jail was then dedicated solely to MS inmates.
Ciudad Barrios was meant to be a model prison when it opened
Ten years later, it holds twice its official capacity of 900 prisoners: 1,873 men sentenced to between three and 223 years, for murder, rape, kidnapping, and other offences.
There is little for the men to do, and little space in which to do it.
Around 60 inmates sleep in each dormitory, two to a bed.
At weekends, the rooms used for conjugal visits are in such great demand that prisoners have created alternative spaces for intimacy in the main hall, using sheets rigged up as makeshift tents.
Hygiene in the jail is minimal. Thirteen prisoners have recently been diagnosed with pulmonary tuberculosis.
Crucially, rehabilitation efforts are underfunded and lacklustre.
Most inmates ignore the limited school classes and workshops on offer, preferring to spend the day watching games in the prison yard or playing cards near the dormitories.
The more experienced prisoners, many of whom speak fluent English following time in the US, are keen to present the gang members as victims of these poor living conditions, which include an unvaried prison diet of rice and beans.
"We need opportunities to work," said one, pointing to the MS mural in the prison yard as an example of the gang members' potentially marketable artistic talent.
The MS mural dominates the area used as the prison's basketball court
"We can't stop being gang members, but we can be productive."
The line between belonging to a gang and committing violent offences remains difficult to draw. Some inmates are already thinking of the scores they'll settle in the future.
One, aged 26, still has 12 years to serve for stabbing and wounding someone. When he gets out of jail, he says, he'll finish the job.
Other prisoners may be on the receiving end of violence when they get out. As long as they have MS tattooed on their chest, back or face, as most of them do, they will be targets for the police and for the Pandilla 18.
"If a guy from another gang finds me on the street, he's going to give me a bullet," said one inmate.
But few say they regret acquiring the tattoos, in some cases when they were as young as 13.
For Jeanette Aguilar, the path to taming El Salvador's prisons should include strengthened rehabilitation programmes, blocking mobile phone signals, and dealing with prisoners according to their criminal profile, not by which gang they belong to.
How El Salvador's new, left-wing president, Mauricio Funes, plans to tackle the issue remains to be seen.