Residents protesting against overcrowded living conditions at a shelter for abused children and teenagers in Guatemala were responsible for a fire that killed at least 22 girls, police say.

The fire broke out on 7 March when several young people tried to escape the overcrowded shelter and set mattresses alight following a riot with police, national police chief Nery Ramos confirmed.

At least 22 girls were killed and around 40 people were taken to hospital with serious burns.

"What happened is extremely serious, and even more so for the fact that it could have been avoided," Guatemala's solicitor general, Anabella Morfin, told reporters at a press conference.

"This should never have happened," she said.

Police were sent to the shelter on 7 March after a riot broke out among residents over poor living conditions. 500 people were crammed into the children's centre, which was built to house 400, according to Guatemalan media.

Guatemala children's shelter
Family members react as they wait for news of their loved ones after a fire broke out at the Virgen de Asuncion home in San Jose Pinula on the outskirts of Guatemala City Saul Martinez

More than 40 people escaped from the centre but were captured by police and isolated, according to Ramos.

Government spokesperson Heinz Heimann condemned the open living arrangements at the shelter. "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," he told Reuters.

As relatives of the victims gathered at the shelter on Wednesday night (8 March), harrowing stories of abuse emerged. Domestic worker Alicia Lopez told reporters that her 12-year-old autistic son, who moved to the shelter with a serious drug addiction, was raped there last week.

Guatemala's human rights prosecutor Jorge de Leon said in a statement that young children had tried to escape the centre because they were being abused by older residents.

"According to what they say, the bigger kids have control and they attack them constantly," de Leon wrote. "They also complain that food is scarce and of poor quality."

The distraught relatives lit candles for the victims outside the government-run Virgen de Asuncion shelter in San Jose Pinula, 25 km (15 miles) southwest of Guatemala City.

President Jimmy Morales declared three days of national mourning.

Guatemala children's shelter
Candles are lit during a vigil for victims after a fire broke at the Virgen de Asuncion home in San Jose Pinula on the outskirts of Guatemala City Saul Martinez/Reuters