Rescuers uncovered more corpses buried under mountains of mud and wrecked homes on Friday as the death toll from torrential rains and massive flooding topped 500, Brazil's deadliest natural disaster in four decades.

Rivers of mud tore through towns this week in the mountainous Serrana region outside Rio de Janeiro, levelling houses, throwing cars atop buildings and leaving more than 10,000 people seeking shelter and aid.

The extent of the damage exposed major flaws in emergency planning and disaster prevention in a country that aspires to attain developed-nation status in coming years. The disaster also highlighted the huge challenges that new President Dilma Rousseff faces as she strives to upgrade Brazil's creaking infrastructure.

Police were deployed to keep order after looters raided some stores for food and scoured damaged homes for valuables.

At least 532 people were killed by the flooding in a handful of towns -- some of them popular tourist destinations -- about 60 miles (100 km) north of Rio and left more than 13,500 people homeless, according to local authorities.

The number of deaths is going to rise quite a bit. There are still a lot of people buried, said Rubens Placido, a fireman in the hard-hit town of Nova Friburgo, adding that continued rainfall was complicating the search efforts.

Rains were intermittent on Friday, though weather forecasts showed them continuing through the weekend in the region.

The floods have not affected Brazil's main export crops -- soy, sugar cane, oranges and coffee -- but likely caused billions of dollars in damage. The federal government has already earmarked 780 million reais $460 million (289 million pounds) in emergency aid for the rescue and reconstruction efforts.

Television footage showed heavy construction equipment digging through jumbles of downed trees and rubble alongside the broken asphalt that three days ago carried street traffic. Streets were reduced to rivers of muddy water after the equivalent of a month's rain fell in 24 hours.

Overwhelmed morgues had to temporarily store bodies in churches or police stations. Refrigeration trucks were used to haul them away.

Graves were dug in the largest cemetery in the town of Teresopolis as the city's other burial centers were either full or buried under mud.

Teresopolis Mayor Jorge Mario estimated that rebuilding the city would cost at least 500 million reais ($298 million).

Emergency teams could only reach the worst-hit areas on foot and were digging through the rubble with their hands in search of survivors because vehicles and heavy equipment still couldn't get through.

Images shot from a Globo News helicopter showed a hand-written sign saying Five people still buried lying on a concrete athletic field partially covered by mud.

MUD, ROCKS AND WATER

In the poor community of Campo Grande on the outskirts of Teresopolis, a wall of water, mud, and rocks the size of cars crashed down from the mountainside, destroying more than 100 houses, residents said.

While it was impossible to know how many people died, residents said they feared hundreds of people were buried under the mud and debris.

Everything started shaking. It all happened in about five minutes, said Anisio Siqueira da Silva, a 52-year-old whose house remained standing because it was just outside the main path of destruction. All of my neighbors near here died.

The area was mostly deserted apart from stray dogs and a few people salvaging belongings and guarding against looters.

The chances of finding survivors here are zero, said Leandro Vabo, head of a medical team searching for bodies in Campo Grande.

Da Silva and others in the village said many of the houses that were swept away had been built too close to the river as the community's population grew in recent years.

Rousseff said on Thursday after visiting the region that Brazil urgently needs to address a housing deficit that forces many poor people to build illegally in risky areas.

In Nova Friburgo, a rural town first settled by Swiss immigrants, at least 246 people died. In Petropolis, the summer residence for Brazil's royal family in the 19th century, 41 people were killed, while at least 19 died in Sumidouro.

Landslides and flash floods are common in much of Brazil, often exposing poor planning and a lack of preventive action.

More than 100 people were killed in April after heavy rains caused the collapse of a hillside slum near Rio that had been built atop a former garbage dump.