An explosion and inferno at a fireworks factory near the Indonesian capital on Thursday (26 October) killed at least 47 people and injured dozens, police said.

Witnesses said a huge explosion was heard from the factory at about 10am and then smaller explosions echoed across the neighbuorhood as orange flames jumped from the building and a column of black smoke billowed from it.

Hary Kurniawan, chief of police in the Jakarta satellite city of Tangerang, said all the bodies recovered so far were found in the remains of the factory and a search of the building is continuing.

Kurniawan said more than 40 injured people were being treated at three hospitals.

The death toll could rise as many of those who escaped have suffered extensive burns, said Nico Afinta, general crimes director at Jakarta police.

"The fire began with a strong explosion like a bomb," Benny, a Tangerang resident who goes by one name, told MetroTV.

He said he saw police and residents smash through a factory wall to help workers out. Some of the victims were burning as they ran out, he said.

According to witnesses at the scene, there was a sudden explosion, which blew off the roof, Jakarta police spokesperson Argo Yuwono told the Jakarta Globe daily.

"Some students and teachers even jumped over the school's fence to avoid the fire that was growing bigger," Indra, an onlooker who lives in the locality told the daily

The factory is located next to a residential area in Tangerang, a city in Banten province on the western outskirts of Jakarta. A police report said the fire spread after an explosion and that the factory's roof had collapsed.

It is still unclear how many people were present in the factory when the explosions took place. On any given day more than 100 people worked at the unit. Local reports say the factory began its operations only two months ago.

"We are still investigating the cause of the fire and questioning witnesses," Kurniawan told reporters. "Factory owners or anyone who neglects and violates safety rules should be held legally responsible."

Indonesia's MetroTV, quoting a local official, said although the factory had a permit, its proximity to a residential area was against regulations. Safety laws are often inconsistently enforced in Indonesia.

Indonesia fireworks factory explosion
This picture shows a general view of a firecracker factory that burned down in Tangerang Kota, Banten province on October 26, 2017. At least 47 people have been killed and dozens more injured in a blaze that tore through a fireworks factory outside Jakarta, police said, triggering explosions and sending plumes of black smoke into the air. DEMY SANJAYA/AFP/Getty Images