TANGERANG, Indonesia (AP) — Investigators Friday were trying to determine the cause of an explosion and fire at a fireworks factory near Indonesia's capital that killed at least 47 people, mostly young female workers unable to escape.

Survivors told authorities the fire started from the factory's drying section, where finished fireworks are dried, many under the sun, before they are distributed and sold. Witnesses heard a huge explosion about 10 a.m. Thursday, followed by smaller blasts that echoed across the residential neighborhood on the outskirts of Jakarta as orange flames jumped from the building and columns of black smoke billowed.

As investigators tried to piece together what happened, relatives crushed by grief went to a police hospital's morgue in eastern Jakarta Friday morning to identify loved ones. Officials said all of the bodies were burned beyond recognition.

"The condition of the corpse were hard to recognize ... can only be identified through DNA and dental data," said Umar Shahab, who heads medical and health division at the Jakarta Police.

Tangerang police chief Harry Kurniawan said 46 injured people were being treated at three hospitals.

The death toll could rise as many of those who escaped suffered extensive burns, said Nico Afinta, general crimes director at Jakarta police. He said bodies were found piled at the rear of the building.

Police said 103 people were working at the factory and 10 are still unaccounted for. Some or all of those 10 may not have come to work Thursday or suffered only minor injuries and didn't seek medical attention, said Jakarta police spokesman Argo Yuwono.

A local resident told Indonesia's MetroTV he saw police and residents smash through a wall of the factory so trapped workers could escape. Some of the victims were burning as they ran out, he said.

"The fire began with a strong explosion like a bomb," Benny, who goes by one name, told the TV channel.

Kurniawan said police didn't want to speculate on the cause of the fire until the investigation was completed. "We are now questioning intensively witnesses, including the factory owner and manager," the police chief said.

A worker who escaped the fire said the staffers were mostly women employed on a casual basis.

Mumun, who goes by one name, told Indonesia's TVOne she started working at the factory a few weeks ago and was paid 40,000 rupiah ($3) a day.

"I lost so many friends. I couldn't help. Everybody just ran for safety," she said, weeping.

Another survivor, Ahmad Safri, said the workers had poor working conditions in a sweaty warehouse with noisy engines, but he denied workers were locked inside when the fire spread. "Many panicking workers run to wrong direction... maybe to a generator room that was locked," Safri said.

He said some workers seemed like young women and teenagers, but he was not sure if any were underage.

Minister of Manpower Hanif Dhakiri said his department would investigate the allegations some workers were underage.

The factory is next to a residential area in Tangerang, a city in Banten province on the western outskirts of Jakarta. It had been operating for less than two months, Kurniawan said.

"Factory owners or anyone who neglects and violates safety rules should be held legally responsible," Kurniawan told reporters.

MetroTV, quoting a local official, said although the factory had a permit, its proximity to a residential area was against regulations.

Safety laws are inconsistently enforced or even completely ignored in Indonesia, a poor and sprawling archipelago nation where worker rights are often treated as a lower priority than economic growth and jobs.

Copyright 2017 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.

Outbrain