Riots in seven Guatemalan prisons killed 31 young male prisoners Monday. The gang-related violence began Monday with two grenade explosions, and was followed by coordinated attacks by Mara Salvatrucha members against rival MS-18, Interior Minister Carlos Vielmann said.

Guatemalans lined up Tuesday outside a small pink-and-white building that served as a morgue to identify the dead inmates.

"This is a war and the gang members are winning," said Rolando Gamez, 41, who waited to see if his son, Gerardo Gomez, 17, was among the victims.

At El Hoyon prison, where 400 alleged gang members were housed when the attacks began, authorities rummaged through piles of trash, foul-smelling mattresses and clothes in search of weapons and clues.

Eighteen inmates died within about 45 minutes at the prison, which is in downtown Escuintla, a provincial capital 50 kilometres south of the capital, Guatemala City. Rival gangs in El Hoyon battled with guns and knives before being subdued by authorities.

Officials said gang members used cellphones and text messages passed by visitors to co-ordinate the near-simultaneous rioting in the prisons.

Vielmann said smaller disturbances were quashed at three other prisons, and that Monday's attacks showed the coordination and strength of the gangs who have spread terror throughout much of the region, prompting harsh crackdowns by authorities.

"The gangs maintain constant communication," he said. "They have a web page and not only synchronize in Guatemala, they synchronize with El Salvador, Honduras and with the United States."

A region-wide campaign against the gangs has put thousands of the tattooed "maras" behind bars, leading to prison feuds between rival gangs.