A massive fire raged through an informal settlement outside Cape Town on Sunday, killing at least six people and leaving an estimated 4,000 homeless. City planners are hoping to improve services in the squatter camp when the rebuilding phase starts. As many as one-fifth of all South Africans live in shacks and other so-called informal housing, which is particularly vulnerable to fires.

The fire swept quickly through the Joe Slovo informal settlement, in the township of Langa near Cape Town. It was an unusually hot day, with temperatures reaching 32 degrees Celsius, and the wind fueled the flames until they had devoured roughly 1,000 shacks.

Cape Town Emergency Services spokesman Johan Minnie says the blaze was the largest the city has seen since 2000. But he says fires rage through South Africa's informal settlements all too often, and are hard to stop once they've started.

"Fires spread easily in informal settlements due to the nature of constructio," explained Mr. Minnie. "The structures are constructed of flammable materials, including wood, cardboard and plastics. So therefore it is extremely easy to burn and it spreads quickly, because they are packed quite close together. The further difficulty is that our fire services can't get easy access to the seat of a fire, can't get close into the fire because there are no access routes into the areas."

South Africa's squatter camps started in the apartheid era, when the white minority government tried to discourage blacks from moving to cities such as Johannesburg or Cape Town by refusing to build houses for them, and refusing to give them residence permits. But people came from the countryside anyway, looking for jobs, and they built their own houses out of tin sheets and spare lumber.

Today, vast shacklands have taken root outside every major South African city, and in many rural communities as well. Although the government has built more than a million houses since 1994, new people keep moving into the informal settlements when the old residents move out. According to the latest census, about 16 percent of all households are living in so-called informal dwellings, and up to 20 percent of the population.

Many of the squatter camps lack even the most basic services, such as clean water, sanitation and electricity. They are not only vulnerable to fire, but in Cape Town, to floods as well.

Mr. Minnie says after a disaster like the fire in Langa, the city tries to use the rebuilding phase as a chance to improve the residents' living conditions.

"After such a fire, the city immediately investigates whether it's not possible to reduce risk in the rebuilding process, because it can be an opportunity to reduce risk," he said. "We try to make sure there is a more formalized pattern of settlements so there are access tracks, and then fire hydrants and other services like electricity can be installed in the areas."

But city planners have to act quickly, because Mr. Minnie says residents want to rebuild their shacks as quickly as possible. Some in the Joe Slovo settlement have refused to move into temporary shelters provided by the city because they are afraid of losing their plots of land. Within three days, he says, all of the shacks destroyed in a fire will usually have been rebuilt.