A man has admitted setting fire to a crowded housing block in Johannesburg in South Africa last year, to cover up a murder, triggering a blaze that killed 77 people.

The 29-year-old South African was detained yesterday after coming forward to confess to an inquiry established to investigate the tragedy in August last year, police said.

Separately, a human rights observer who was present at the inquiry told AFP that the man had explained that he started a fire to cover up a murder during a bungled gang-related beating.

In August, 77 people including 12 children were killed and scores injured as the blaze ripped through a five-storey building taken over for illegal housing in central Johannesburg.

It was one of the deadliest urban fires around the world in recent years and the disaster sparked a renewed debate about housing in South Africa's run-down inner cities.

Arson was suspected, but the latest details on what may have happened only surfaced when the man came forward this week.

According to Andy Chinnah, a rights activist with Amnesty International who was present at the inquiry, the suspect confessed to being a drug user who had befriended a dealer in the building.

He helped "knock people up" if they had a problem with the gang boss, in a room called the "slaghuis" or "butchery" where victims were tied to a chair and beaten.

On the day of the fire, Mr Chinnah said, when the suspect "pulled the sack off the victim's head he noticed that the guy was someone he knew".

Under the influence of drugs, and fearing that he would be identified, the suspect murdered his victim and then went to a nearby petrol station to buy fuel, before dousing the body and setting it alight.

"As he stood outside and watched the building burn, he said, he saw a child being thrown out from the fourth floor and a woman jumping," Mr Chinnah said.

"He said he then realised what he had done was much bigger than what he intended."

The building had been taken over for illegal housing

Eventually the fire-starter decided to come to the inquiry to confess, said the activist, who has also been briefed by lawyers for the victims.

A police spokesman said the suspect would appear in court "soon" on charges of arson, 77 counts of murder and 120 counts of attempted murder.

After the fire, bodies were discovered piled up at a security gate that was closed, preventing people from escaping the blaze.

Some residents managed to break open a locked fire escape gate and run to safety, while others jumped out windows - some throwing babies out for safety.

The disaster sparked a renewed debate about housing in the inner cities. During his visit to the site president Cyril Ramaphosa said it was "a wake-up call".

Illegal occupation of abandoned buildings in downtown Johannesburg, which slumped into decay and economic decline in the 1990s, is widespread.

First, international sanctions against the former apartheid regime in the 1980s took a toll.

Then the advent of democracy in 1994 saw many white-owned businesses move out to suburban districts with fenced compounds and private security teams.

City authorities said the municipal-owned, listed building in a crime-ridden area had been turned into illegal housing after being abandoned, possibly run by syndicates who collect rent from occupants.

They estimated that more than 80 "shacks" were set up inside. Most of the people living inside the building were immigrants, according to a resident who spoke to AFP at the scene.

Police raided the building in 2019, arresting 140 foreign nationals, but, in a country struggling with massive crime rates, little changed.