SAN JOSE PINULA, Guatemala, March 8 (Reuters) - A fire tore through a home for abused teenagers and children in Guatemala, killing at least 22 girls on Wednesday after some residents set mattresses ablaze following an overnight attempt to escape from the overcrowded center, police said.

A crowd of relatives, some wailing with grief, gathered outside the government-run Virgen de Asuncion home for youths aged up to 18, in San Jose Pinula, 15 miles southwest of the capital, Guatemala City.

Hospitals reported about 40 people being treated for burns.

The blaze started when a group of young people who had been isolated by authorities after a riot and an escape attempt at the center on Tuesday night set fire to mattresses, said Nery Ramos, head of Guatemala’s national police.

Authorities were investigating whether those who started the blaze were the ones who had tried to escape, Ramos added.

“What happened is extremely serious, and even more so for the fact that it could have been avoided,” Anabella Morfin, Guatemala’s solicitor general, told a news conference.

“This should never have happened.”

Burnt bodies partially covered in blankets were strewn across the floor of a blackened room in the home, pictures posted to Twitter by firefighters showed.

“We will fully support the institutions responsible for investigating, and we will contribute to finding the truth,” President Jimmy Morales said in a brief statement on national television Wednesday night.

Morales earlier declared three days of national mourning.

Mayra Veliz, secretary general of the attorney general’s office, pledged a transparent investigation into the cause of the blaze. She said a group of disabled girls had been bused to another shelter as detectives scoured the site.

Plagued by Latin America’s worst rates of child malnutrition and street gangs like the Mara Salvatrucha that often prey on minors, Guatemala can be a traumatic place to grow up. Conditions in the Central American nation’s public institutions are often dismal with widespread overcrowding.

Saul Martinez / Reuters Friends and family of the fire victims held a vigil on the outskirts of Guatemala City Wednesday night.

DISTRAUGHT RELATIVES

On Tuesday night, riot police went in to quell unrest over the home’s conditions. Dozens of residents escaped, but 54 were recaptured and isolated, Ramos said.

The Virgen de Asuncion home has long suffered from overcrowding, with Guatemalan media reporting that more than 500 people were crammed into the center designed to house 400.

Distraught relatives said abuse was common at the center, which is run by the Ministry for Social Welfare, and presidential spokesman Heinz Heimann condemned what he described as the shelter’s open living arrangements.

“It shouldn’t be possible that girls who simply were suffering, that didn’t have any problems with the law, are mixed with young people who have committed crimes,” Heimann said.

“This can’t be allowed to continue.”

Domestic worker Alicia Lopez, 50, had been outside the home for hours trying to find out what happened to her autistic 12-year-old son who came to the center with a drug addiction. She said he had been raped there last week.

“I still don’t have information. ... I want justice for him,” Lopez said at the home, which takes in abandoned children as well as victims of abuse and trafficking.

Andrea Palomo told reporters in tears that she had brought her 15-year-old son to the home to discipline him. He told her he was mistreated and complained that gang members there tattooed the children, she said.

Guatemala’s ombudsman for human rights decides whether children are placed in the home and some parents praised it.

Cristina Puac, 59, said her adopted teenage daughter Gladys was placed there for being rebellious and aggressive, and stealing things.

“When I came to see her, everything seemed fine,” she said. “She never complained about anything.”