TAIPEI, Taiwan — A fire tore through an apartment complex in the southern Taiwanese city of Kaohsiung early Thursday, killing 46 people and leaving 41 injured.

According to Kaohsiung’s fire department, the blaze broke out about 3 a.m. in a 13-story building that was home to about 120 households, many of them composed of elderly or disabled people or workers.

One nearby resident said he heard an explosion about 2:40 a.m. and then saw the building burning as people ­outside yelled for those inside to get out and cars began ­honking their horns to alert residents.

A fire in a residential building in the southern Taiwanese city of Kaohsiung has killed 46 people and injured another 41, the government said Oct. 14. (Reuters)

Footage showed firefighters battling the blaze as smoke ­billowed from the building. In videos posted on social media, people on the street waited for news of their relatives. Some knelt while others called out for their parents, believed trapped inside.

“The fire was extremely fierce and as a result, many floors were severely burned,” the department said in a statement, adding that the age of the building and the amount of debris in its stairwells had accelerated the fire and hampered rescue efforts.

The fire was extinguished about dawn, and rescue operations had concluded by Thursday afternoon.

According to Taiwan’s Central News Agency (CNA), Kaoh­siung’s police said that arson had not been ruled out and that four people had been taken into custody for questioning.

The 40-year-old building in the popular tourist district of Yancheng had been partly abandoned, with residents living on only the building’s upper levels. Described as a “city within a city,” the building was once one of the busiest in the district, housing a cinema and market and serving as a red-light district, according to local media reports. Because of its checkered past, it was known among locals as Kaoh­siung’s first haunted house.

Kaohsiung City Council Speaker Zeng Li-yan called on the government to conduct an audit of other old and possibly dangerous buildings, calling such structures a “safety blind spot due to lack of management,” according to CNA.

Taiwan’s President Tsai Ing-wen said the government would do its utmost to relocate or assist those affected by the fire, expressing her “deepest condolences” to the victims.

Pei Lin Wu and Alicia Chen in Taipei and Lyric Li in Seoul contributed to this report.