TERESOPOLIS, Brazil (Reuters) - Rescuers uncovered more corpses buried under mud and wrecked homes in southeastern Brazil on Friday as the death toll from torrential rains and massive floods hit 540 people and looked certain to climb.

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

It was Brazil’s deadliest natural disaster since 785 people were killed in floods in 1967, a local newspaper reported.

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.

It also highlighted the huge challenges that new President Dilma Rousseff faces as she strives to upgrade Brazil’s creaking infrastructure before it hosts soccer’s World Cup in 2014 and the Olympics two years later.

The floods have not affected Brazil’s main export crops -- soy, sugar cane, oranges and coffee -- but likely caused billions of dollars in damage.

Police were deployed to keep order in the handful of towns -- some of them popular tourist destinations -- about 60 miles north of Rio after looters raided stores for food and scoured damaged homes for valuables.

“The number of deaths is going to rise quite a bit. There are still a lot of people buried,” said Rubens Placido, a firefighter in the hard-hit town of Nova Friburgo.

Intermittent rains were complicating the search efforts and more showers were forecast for the weekend.

RISKS FOR ROUSSEFF

Rousseff, a career civil servant who never held elected office before being sworn in as president on January 1, visited the region on Thursday and pledged a swift relief effort that has yet to pan out in some of the hardest-hit areas.

Public anger so far has been directed at state and local authorities, who were responsible for allowing much of the precarious construction in risky areas that contributed to the rising death toll.

But Rousseff must project competence and empathy early in her administration when she remains a relative unknown to many Brazilians.

“If she were seen to be slow on disaster relief, she could be in trouble. But that hasn’t happened,” said Carlos Manhanelli, a Sao Paulo-based expert on political marketing.

The federal government has earmarked 780 million reais ($460 million) in emergency aid and donations were starting to pour in from around the country.

Television footage showed heavy construction equipment digging through downed trees and rubble alongside broken asphalt. Streets were reduced to rivers of muddy water after the equivalent of a month’s rain fell in 24 hours.

Overwhelmed morgues had to store bodies in churches and police stations. Refrigerated trucks hauled them away.

Slideshow ( 25 images )

Graves were dug in the largest cemetery in Teresopolis, where at least 231 people were killed, as the city’s other burial centers were either full or buried under mud. Rows of freshly dug graves were marked with simple wooden crosses.

The mayor of Teresopolis estimated that rebuilding the city would cost at least 500 million reais ($298 million).

Emergency teams could reach some areas only on foot and were digging through the rubble with their hands because vehicles and heavy equipment could not get through.

Slideshow ( 25 images )

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.

“Everything started shaking. It all happened in about five minutes,” said Anisio Siqueira da Silva, 52, whose house remained standing because it was just outside the 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 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.

In Nova Friburgo, a rural town first settled by Swiss immigrants, at least 247 people died. In Petropolis, the summer residence for Brazil’s royal family in the 19th century, 43 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 last April after heavy rains caused the collapse of a hillside slum near Rio that had been built atop a former garbage dump.