Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

A boiler exploded and triggered a fire at a packaging factory near Bangladesh's capital on Saturday, killing at least 23 workers and injuring dozens, officials said.

Fire officials said that the explosion at the five-story Tampaco Foils Ltd. factory in the Tongi industrial area outside Dhaka was huge, and that the fire triggered by the blast spread quickly because flammable chemicals were stored at the factory.

Rescuers try to extinguish a fire at a garment packaging factory outside Dhaka, Saturday. MOHAMMAD PONIR HOSSAIN / Reuters

At least six of the 14 people being treated for burns at Dhaka Medical College and Hospital were in critical condition, said Mohammed Bacchu Mia, a police official at the hospital. He confirmed that at least 23 people had died.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Local TV stations said about 50 people were injured in all. Television footage showed smoke billowing from the factory, with the fire engulfing part of the upper floors.

Factory safety is a major concern in Bangladesh, which has thousands of garment and packaging factories that supply products to global chains like Wal-Mart and H&M. In 2012, a fire at a garment factory in a Dhaka suburb killed 112 workers. A year later, a commercial complex near Dhaka housing five garment factories collapsed, killing 1,135 people, Bangladesh's worst industrial disaster.

It took firefighters nearly five hours to bring Saturday's blaze under control. Huge piles of burned materials and chemicals had to be removed from the building to prevent the fire from spreading further, officials said.

It was not immediately clear what caused the explosion, which occurred at around 6 a.m. Authorities have ordered an investigation.

Syed Mokbul Hossain, the owner of the Tampaco Foils factory, told the Bengali-language Prothom Alo daily that he was not sure when the boiler was last inspected.

A woman mourns at a hospital after the factory fire outside Dhaka, Bangladesh, Saturday. MOHAMMAD PONIR HOSSAIN / Reuters

He said around 75 people had been scheduled to work the overnight shift. Saturday was the last working day at the factory before the workers were to go on leave for a weeklong holiday for the Islamic festival of Eid al-Adha, which falls on Tuesday.

The major factory accidents in 2012 and 2013 prompted Bangladesh's government, global brands and the United Nations to work together to try to improve safety standards in the South Asian country's factories.