A fire that killed at least 74 people in a five-story building in downtown Johannesburg on Thursday has prompted calls for the authorities to do more to address an acute housing crisis and crack down on the city’s hundreds of such derelict, overcrowded buildings.

It was one of the worst residential fires in South Africa’s history, and on Friday morning health officials asked family members to help identify some of the dead.

Here’s what we know about the fire and the circumstances surrounding it.

It is not yet known how the fire started, but it may have begun on the ground floor of the building, a structure that once housed offices of the apartheid government and served as a checkpoint for controlling the movement of Black workers in and out of the city.

The authorities have yet to determine the precise origin of the blaze, but officials, experts and locals described the overcrowded building, which had been subdivided into a warren of small rooms, as a firetrap and a disaster “waiting to happen.”

Flammable materials like cardboard and sheets separated the living spaces. Electric cables dangled from the ceiling. And people who live in such substandard housing in Johannesburg often lack steady access to electricity, leading them to rely on candles, small fires or even makeshift hookups to the power grid.

Health officials said that at least 12 children had died in the blaze, and at least 61 survivors were treated in hospitals.

Some of the dozens who died may have been blocked by an internal security gate while trying to escape the fire. Mgcini Tshwaku, a City Council member who oversees public safety, said that at least some of the victims had been found behind a locked gate on the ground floor.

The sprawling red-brick building housed hundreds of people. Some were South Africans, while others were migrants from across the region who had arrived in Johannesburg in search of a better life.

The authorities in South Africa have yet to identify many of those killed in the fire. Late Thursday, Nomantu Nkomo-Ralehoko, a local health official, told reporters that of those identified so far, at least two were from South Africa, two were from Malawi and two from Tanzania.

Because some bodies were burned beyond recognition, DNA testing will be needed to verify their identities.

After the fall of apartheid in the 1990s, ending the crippling restrictions on where Black people could legally live in South Africa, many moved to cities in search of better opportunities. But there was not enough affordable housing to meet the demand.

Around the same time, landlords began abandoning buildings in Johannesburg’s commercial center, and the structures slowly filled up with poor and desperate people who could not afford anything else on the market.

The authorities now say that such buildings are often “hijacked” by organized groups demanding payment from those who live there.

“The lesson for us is that we’ve got to address this problem and root out those criminal elements,” President Cyril Ramaphosa of South Africa said on Thursday night. “It is these types of buildings that are taken over by criminals, who then levy rent on vulnerable people and families who need and want accommodation in the inner city.”

More than 600 derelict buildings in Johannesburg are being illegally occupied, according to one city official, including 30 structures owned by the city. And the city, which is now on its sixth mayor in less than three years, has struggled to crack down on the squatters, in part because of a legal obligation to rehouse people it evicts from such spaces.

Although the City Council has recently inspected just over a dozen such buildings as part of efforts to clear them, the authorities have also cited safety concerns as obstacles to conducting any checks on the structures.

Rapulane Monageng, the city’s acting chief of emergency management services, told reporters on Thursday night that after a nonprofit group that once leased the five-story building left the site, inspectors did not return to conduct another code check. “We wouldn’t want to go into a hostile environment,” he said.