At least 13 people were killed and up to 50 injured after a boiler exploded at a garment factory in Bangladesh on Monday, authorities said.

Dozens of labourers were on site at the facility in an industrial district outside the capital, Dhaka, when a blast tore through the six-storey building, causing its walls and a roof to collapse.

"It is a terrible scene. Fire brigade officers have arrived and are doing rescue work. The factory's boiler exploded and the blast also affected other buildings near the factory," police officer Harunur Rashid told the AFP news agency.

"Eight people were killed and approximately 50 were injured. Six bodies were recovered at the spot and two more in the hospital. The casualties included passers-by who were walking outside the factory," Mohammad Akhteruzzaman, deputy assistant director of the fire service, told AFP.

READ MORE: Rana Plaza, three years later: Who has paid?

He said the explosion was so powerful that it destroyed parts of the factory, including "a roof and several walls".

On Wednesday, rescue workers called off their search for survivors.

Thirty-five people are undergoing treatment at different health facilities in the Gazipur district, according to physician Pronoy Bhushan Das, and many of those injured are in critical condition.

Al-Amin, a worker at a nearby garment factory, said he was attending evening prayers at a mosque close to the factory at around 7pm (13:00 GMT) when the explosion shook the whole area.

"I ran to the spot instantly and saw a huge smoke. I saw blood all over the bodies of some injured workers and instantly called the fire brigade," he told AFP.

According to factory director Mesba Faruqui, the main site was closed on Monday but a group of workers were overseeing maintenance of the boiler.

The factory is owned by textiles manufacturer Multifabs, which makes clothing for mostly European brands according to its website.

Bangladesh has more than 4,500 garment factories employing four million mostly female workers at a minimum monthly wage of $68.

The industry is notorious for poor workplace safety, with many of the factories lacking basic equipment such as ventilation and air coolers.

In April 2013, the nine-storey Rana Plaza factory complex collapsed, killing more than 1,100 people in one of the world's worst industrial disasters.

The Bangladeshi government and international buyers have been trying to improve working conditions in the garment sector, which adds about $29bn in terms of exports to the country's economy, according to the Bangladeshi statistics office.