Officials blame immigrants and liberal housing laws, but a Times investigation found the entrenched problems that turned downtown Johannesburg into a blighted tinderbox.

Days after the fire, officials in Johannesburg reached for a well-worn script. They gathered the media for a made-for-television police raid.

The blaze had swept through a government property at 80 Albert Street, a deathtrap of a building where squatters pilfered electricity, built indoor shacks out of cardboard and cooked on paraffin stoves. The authorities could do nothing there except sift through the ashes.

So instead, they turned their attention to another government-owned property, Vannin Court. It’s an eight-story building where hundreds of people live without running water or power.

“When people die in these buildings, it is the city of Johannesburg that gets blamed,” Kenny Kunene, a city official, told TV cameras minutes before the raid began. “Now we are going to save the lives of our people.”

Police cars surrounded the building and officials barged inside to find trash clogging the elevator shaft three floors deep. A bathtub sat full of rancid water. Mattresses were wedged into unusable bathrooms. The building choked with cooking smells, decaying trash and human waste. One apartment frequently catches fire, but the stairs on the fire escape were sawed off and sold as scrap long ago.

Johannesburg officials have publicly blamed immigrants and progressive housing laws for the large number of dilapidated buildings like this. But a New York Times investigation found that for decades, multiple governments and political parties have ignored the problem. Financial records show that the city’s property management agency is insolvent, despite holding thousands of properties, including some in the wealthiest sections of the city. The agency, which has been dogged for years by corruption allegations, does not have an audited list of its holdings. Some low-level municipal officials have capitalized on this by illegally collecting rent from squatters, according to multiple current and former city officials.

The city government has effectively abandoned its downtown housing stock, following in the footsteps of many private landlords who have deserted their buildings. Armed men, desperate families and opportunistic squatters have moved in, creating vertical slums in full view of the government.

Despite the many hazards — fire, crime and more — that come with such widespread neglect, officials from the property agency and the mayor’s office have failed for years to even catalog the city’s dilapidated buildings, the first step in averting future disaster.

In response to the fire, Times reporters compiled a list of derelict buildings in central Johannesburg. They reviewed internal city government records, combed housing lawsuits and consulted a document from a lawyer representing landlords. Reporters then visited the buildings and interviewed tenants and others to confirm the data.

The Times count is conservative in a city where whole blocks are blighted by decay and bear the unmistakable signs of illegal and unsafe occupation.

The cause of the 80 Albert Street inferno remains unknown, but these buildings are so dangerous that another tragedy appears inevitable. Within four weeks of the Albert Street blaze, fires broke out in three other dilapidated buildings, leaving dozens of people homeless.

“There are buildings where it would be safer to be on the street than to live in that building,” said Greg Vermaak, a lawyer who represented the city in the early 2000s and now works for private landlords.

Vannin Court was one of several buildings targeted by police raids in the fire’s aftermath. The stated plan was to inspect and perhaps clear them to prevent the next disaster. But nothing would change.

The residents who milled around, watching the spectacle, knew it. So did the officials. After all, the city had failed to fix the building for nearly two decades, despite numerous other raids. In fact, this was the second raid in about five months.

Vannin Court followed a familiar path to despair. In the early 1990s, as white families fled downtown Johannesburg, banks redlined the neighborhood, refusing to lend money there. Real estate values tanked, discouraging investment from landlords who suddenly struggled to find paying tenants.

Utility bills went unpaid, and eventually the city cut off power and water. That is when armed men moved in, according to Masindi Cabrali Mmbengwa, a ward councilor who represents the neighborhood.

The men controlled apartment units, charged rent and used the building as a hideaway, according to the police.

“It became a no-go area,” Mr. Mmbengwa said. He last visited the building alone while campaigning in 2004. He has not gone inside since without an armed police escort, he said.

In 2007, the city seized the building, but could not make major changes. By law, housing is considered a human right. If the government wants to evict people, it must provide somewhere else for them to live.

Consecutive city redevelopment plans have failed over this issue. Municipal officials have proposed giving buildings to developers or city agencies that build affordable housing. But the city was unwilling or unable to build temporary housing for tenants who would be evicted during the renovations.

“They want to rescue the buildings,” said Nomzamo Zondo, a housing lawyer with the Socio-Economic Rights Institute of South Africa. “They could not care less for the people.”

One reason for this deadlock is that politicians chafe at the idea of building housing for immigrants.

“The city does not have money to keep on building properties for the influx of all these foreigners,” said Shadrack Sibiya, who until recently led a government task force to address what are known as “hijacked” buildings — those taken over by criminals.

Officials say newcomers from Malawi, Zimbabwe and Mozambique are overcrowding the city and straining its resources. But they have never provided data to support that argument. Immigrants do come to Johannesburg in large numbers, but so do migrants from rural South Africa. This is true in Vannin Court, where many of the tenants interviewed by reporters were South Africans.

The city’s property manager, the Johannesburg Property Company, contributes to the neglect. The agency is in charge of leasing and maintaining nearly 30,000 city properties but has become delinquent itself.

The agency is insolvent even though it is buttressed by municipal and provincial subsidies, according to its financial records. It resists scrutiny of its lease agreements, even by city officials and its own board of directors, according to former board members, ward councilors, and politicians who oversaw the department.

“We didn’t even know how many buildings we actually owned as the city,” said Mpho Phalatse, a former mayor.

The agency’s chief executive, Helen Botes, was suspended twice in the last three years. A federal anti-corruption unit found that she authorized spending millions on questionable cleaning contracts during the coronavirus pandemic without the board’s approval. A separate internal investigation accused her agency of spending millions to house its finance department in a different municipality, despite the city’s vast portfolio.

In interviews, former Johannesburg Property Company board members described a culture of intimidation and retribution. Former board members said Ms. Botes and her executives kept information from them about agency operations. But Ms. Botes, a civil servant, has outlasted 10 mayors.

“It’s meant to be chaotic,” said Brenda Madumise, a former board chairwoman, “so that then there is money that disappears into people’s pockets.”

The Johannesburg Property Company also owned and was supposed to maintain the building at 80 Albert Street. When officials visited the building in 2019, according to records and officials, they noted the flammable makeshift partitions, the obstructed fire exits, the shacks on the roof and the rats on every floor. But nobody returned to fix the issues, nor did anyone try to wrest control from the criminals who were illegally collecting rent.

Ms. Botes and the property agency did not respond to requests for comment, referring questions to the city manager. A spokesman for the city manager did not respond, either.

The same neglect extended to Vannin Court. In 2019, the Johannesburg Property Company contracted with a private developer to renovate the building and turn it into mixed-income apartments. A tenant survey was conducted and a security contractor installed turnstiles to monitor who came and went. Architects measured the interior and drew plans.

But the project stalled for familiar reasons. The city made no concrete plans to house the tenants. Ultimately, the developer ran out of money. Both the security company and the architect said they had gone unpaid.

In the immediate aftermath of the Albert Street fire, two city officials turned the tragedy into a political talking point: Mr. Kunene, who spoke to reporters before the Vannin Court raid and is in charge of the transportation system; and Mgcini Tshwaku, who oversees public safety. They framed the fire in terms of immigration. (The mayor, a political novice from a small party, appeared at a few public events but was overshadowed by Mr. Kunene and Mr. Tshwaku.)

In just over a week, they raided six buildings and, in one case, evicted tenants without a court order and welded shut the entrance to one building. They dared judges to visit the buildings themselves before overturning evictions, and vilified the human-rights lawyers who bring such cases. They blamed immigrants as the cause of crime and blight. During the raid at Vannin Court in September, they noted that they’d earned the nickname “the destruction boys.”

But as media attention on the fire faded, so did the raids. Politicians turned to other subjects. “I am tired,” said Mr. Tshwaku, as he walked away from his last raid in September.

Many of the survivors of the Albert Street fire have moved into nearby derelict buildings.

A public inquiry into the cause of the fire has stalled. The venue for the hearings, it turned out, did not meet basic safety standards. The city’s emergency services agency considered it a fire hazard.

About the data

The New York Times gathered the underlying data from documents from the Johannesburg Property Company, past city administrations, the Gauteng City-Region Observatory, the Socio-Economic Rights Institute of South Africa (SERI), the Johannesburg Property Owners and Managers Association, and other records shared with The Times. The Times verified the data by visiting the buildings and, in some cases, interviewing tenants and other people. The catalog includes buildings that met five or more of the following criteria: violation of fire safety codes (no functional fire escape or extinguishers, blocked fire exits, flammable partitions such as shacks built indoors or on roofs and basements, or residents burning open fires indoors); no basic services such as electricity, water or waste collection; clear signs of structural problems; damage from past fires; unrestricted access through the main door; and signs of overcrowding. Reporters verified ownership and other information through the Johannesburg GIS system.