Fighting between prisoners at a jail in El Salvador has left 31 people dead and around two dozen injured, police say.
Prisoners are said to have used the riot for revenge attacks
The violence at La Esperanza prison began when members of the Mara 18 gang clashed with other convicts, the deputy public security minister said.
The country's prison chief said the
situation was "almost under control".
La Esperanza was designed for 800 inmates but holds more than 3,000. Riots are commonplace in central and south America's overcrowded prisons.
Nearly 70 people died in April in an uprising in neighbouring Honduras.
Meanwhile, in May, a fire at a prison in northern Honduras killed more than 100 people.
Officials said the fire was caused by a short-circuit - though survivors of the blaze have alleged it was started deliberately.
Special forces soldiers had been brought in to calm the violence at La Esperanza prison and ambulances were ferrying the injured from the scene.
Gangs rule the roost in El Salvador's overcrowded prisons
The road to the prison was closed while a helicopter monitored events from above, reports said.
Explosions were heard inside the prison compound, which lies on the outskirts of the capital, San Salvador.
According to an official from the state prosecutor's office, the prisoners had used grenades, guns and machetes against each other.
Police were planning to search the facility for firearms after the situation had calmed down.
The authorities had also promised to transfer members of the Mara 18 gang to another prison - a key demand of the rioting inmates, the Reuters news agency reports.
Gangs such as the Mara 18 have been in the line of fire since central American governments vowed to stem a rising tide of street violence.