(CNN) -- Thirty-one people -- mostly teenage girls -- were killed after a fire tore through a youth home in San Jose Pinula, Guatemala.
Wednesday's blaze started when some of the youths at the Virgen de la Asunción Safe Home set fire to a mattress on their way to breakfast, said Abner David Paredes Cruz, an attorney with the office of Guatemala's human rights prosecutor.
Nineteen female residents of the home near Guatemala City -- all between 13 and 17 -- died at the scene, the country's National Civil Police told CNN en Español.
Video from the scene showed sobbing family members outside the home, banging on doors and looking for loved ones.
Twelve others died at hospitals in Guatemala City, according to information released by the Guatemalan Ministry of Health. The fire, which began around 9 a.m. (10 a.m. ET) Wednesday, left 27 others injured.
Support for victims' families
Guatemalan President Jimmy Morales pledged his support to the families of the victims and to the injured, and said the home's director was fired. An investigation into the center has been ordered.
Guatemala's attorney general, Thelma Aldana, had already threatened to shut down the home last year when close to 40 teens escaped from it.
General prosecutor Anabella Morfin said her office was working on "deinstitutionalizing" the center, by reducing the number of treated youths from 720 to 580.
Criticized for overcrowding
The facility houses minors who have suffered physical, psychological and sexual violence, or who have mild disabilities. Some residents have been abandoned or addicted to drugs or have been victims of trafficking, the Guatemalan government said.
Human rights groups have criticized the home in the past for being overcrowded and lacking in specialized care.
"It's a terrible event, what happened, and more terrible that this could be avoided," Morfín said.
Guatemala's volunteer fire brigade posted a photo on social media that showed charred bodies partially covered with blankets spread across the floor.
Some parents gathered at a morgue in Guatemala City.
"I don't know how this came to pass, but this is just unimaginable ... that my daughter would be incinerated. But I have faith in God that there will be justice," Dacia Marcela Ramirez Soza told CNN.
Sobbing, she said she was told at the youth home that her daughter died in the fire. She identified the body at the morgue.
"It's just not possible, this tragedy and the violation of human rights. ... It's sad," Ramirez Soza said.
Other parents feared their children were among the dead.
"I am hurting as a mother because she does not deserve this. I gave her advice. I hope that it is not her," Carolina Juarez, whose daughter was in the home, told Agence France-Presse.
Morfín said her office "has the duty to protect and represent children and adolescent(s) and those vulnerable and that lack representation."
Secretary of Welfare Carlos Rodas said his office will pay for funeral services.
"We cannot recover those lives, but we can analyze the system, make it transparent," Rodas said.
"That it is not about egos, it is not about personalities. These are boys and girls, teenagers."