At least 17 prisoners have been killed in a gang brawl inside an overcrowded Guatemalan prison, including seven who were decapitated, officials say.

Victor Mijangos, assistant prosecutor for the Escuintla district, said on Monday that the fight broke out the afternoon before in the Canada Rehabilitation Farm about 70km south of the capital, Guatemala City.

"All were killed by machete and knife wounds," said Mijangos, who entered the prison. Officials found 16 bodies together inside and one more prisoner died of his wounds at a hospital.

He said officials found the heads of three men, apparently the leaders of a group, on top of a table. No one was killed or wounded by gunfire, he said. Another government official had said earlier that the fight started with gunfire.

Rudy Esquivel, prison system spokesman, said the prison was designed to hold 600 inmates, but houses 3,092. He said firefighters had removed 16 bodies from the prison and they were still being identified.

Al Jazeera's David Mercer, reporting from Guatemala City, said the overcrowding has also led to the conflict situations.

Elsa Rodriguez said she identified her son Estuardo Gregorio Rodriguez, 23, from a photograph a funeral home employee showed her.

She was among about 100 people who waited outside a morgue for the victims' bodies to be released to their families.

Esquivel said the fight apparently erupted between members of the Mara 18 and Mara Salvatrucha gangs and fellow inmates who don't belong to the gangs.

Two thousand police entered the prison to retake control and collect evidence.

Mariela Rodas was inside the prison on Sunday visiting her son when she said gunfire broke out around 3:30pm.

"My son told me to get out fast so nothing would happen to me. I think they already knew," Rodas said. "Then we heard gunshots and we all ran."

Dozens of family members waited outside the prison for word of their relatives on Monday.

Source: Al Jazeera and agencies