BERLIN - Thousands of people have been evacuated from their homes in a region of eastern Germany where the Elbe River has flooded and burst through a dam, while the swollen Danube was approaching Budapest where soldiers and volunteers are building flood walls, officials said Sunday.

Parts of the south and north ends of the Hungarian capital are already under water, but the city's downtown area, including the parliament building and several large hotels near the river bank, are seemingly out of direct danger as flood walls were built to a height of 30.5 feet.

Officials said nearly 8,000 volunteers and specialized crews in Budapest had strengthened flood walls by packing and placing 1 million sand bags, and many are also monitoring defenses for any leaks.

At least 21 flood-related deaths have been reported in central Europe, as rivers such as the Danube, the Elbe and the Vlatava have overflowed after a week of heavy rains and caused extensive damage in central and southern Germany, the Czech Republic, Austria, Slovakia and Hungary.

The latest fatality was an 80-year-old man who died of a heart attack in Austria on Sunday while cleaning up debris caused by flooding, the German news agency DPA reported.

In Magdeburg, the state capital of Saxony-Anhalt in eastern Germany, more than 23,000 residents had to leave their homes Sunday afternoon after many streets and buildings were flooded and electricity was shut off, DPA said.

The neighborhood of Rothensee was especially hard-hit by the floods of the Elbe - residents were being evacuated with tanks, trucks and buses.

"Rothensee is filling up like a bathtub," German army spokesman Andre Sabzog told DPA.

Some 700 soldiers were trying frantically to build a dam of sandbags around a power substation. A flooding of the substation would not only leave thousands of households without drinking water, but also lead to a breakdown of the neighborhood's dewatering pumps.

Another 8,000 people were evacuated from the town of Aken and its neighboring villages after a dam on the Elbe broke Saturday, police spokesman Uwe Holz said.

Farther north on the Elbe, residents were trying to protect themselves from flooding by building levees along the banks of the rising waterway.

Officials in Saxony-Anhalt also were investigating what appeared to be a threat to destroy dams.

Several media outlets said they had received a letter threatening to blow up dams on the Elbe, Holger Stahlknecht, the state's interior minister, said Sunday.

"We are taking the letter seriously," he told DPA. He said authorities stepped up their surveillance of dams and urged residents to remain calm.

In Hungary, officials said the flooded Danube River was expected to reach Budapest late Sunday, but that defenses should keep the water out of most of the capital.