BANDA ACEH, Indonesia (Reuters) - A fire erupted at an illegal oil well in Indonesia on Wednesday killing least 18 people and injuring 41 as they scrambled to collect oil after the well overflowed, authorities said.

Firefighters struggled all day to put out the blaze in the northwestern province of Aceh and were still working as darkness fell.

Dozens of people suffering from burns were taken to hospital in the provincial capital, Banda Aceh, several hours away from where the accident happened.

“There was panic among the public because the fire is in a residential area,” said Sutopo Purwo Nugroho, spokesman for Indonesia’s disaster mitigation agency.

The fire broke out early on Wednesday after a well of depth 250 meters (820 ft) overflowed and residents gathered to collect the oil, the agency said.

Earlier, Nugroho posted pictures on social media that showed flames towering over houses and trees as firefighters hosed down the area while villagers looked on.

“This is illegal drilling,” said Roberth MV Dumatubun, a spokesman for at PT Pertamina EP, a subsidiary of state oil firm Pertamina.

Slideshow ( 7 images )

“It was a well made and managed by the residents there. Incidents like these are likely to happen because they don’t pay attention to elements like safety.”

Pertamina, which has operations in the area, was providing equipment to help fight the fire. At least eight fire trucks had been deployed to try to douse the blaze.

The head of police in the area said the fire might have been sparked by a careless smoker.

“We suspect there was someone smoking,” said police official Wahyu Kuncoro.