Former communists and parties espousing distrust of foreigners posted strong electoral gains in two states of eastern Germany on Sunday as voters expressed anger over high unemployment and unkept promises to bring prosperity to their half of the country.

The National Democratic Party, a radical group that the federal government has tried to ban for its close ties to neo-Nazis, won more than 9 percent of the vote in the state of Saxony, giving it seats in a state parliament for the first time in 36 years. The result was a major embarrassment for Chancellor Gerhard Schroeder's Social Democratic Party, which received about the same percentage, according to early returns.

Former communists took second place, with roughly a quarter of the vote, in both Saxony and the state of Brandenburg, which surrounds Berlin.

Despite their gains, the radical parties were unable to upend the state governments. The Social Democrat-led coalition retained control in Brandenburg; in Saxony, the Christian Democrats lost their majority but appeared set to head an alliance with the Free Democrats.

Leaders from radical parties on both ends of the political spectrum reveled in their success even as they tried to play down their pasts. "You have to bring forth concepts, and we did," said Peter Porsch, a party official with the ex-communists in Saxony who has been accused of past ties to the Stasi, the former East German secret police. "I am pleased with the result."

Holger Apfel, a leader of the National Democrats who has glorified the Third Reich, prompted other candidates to walk off the set of a political round-table television show by making comments they perceived to be xenophobic. "This is a great day for all the Germans who still want to be German," he said.

Schroeder's ruling coalition has tried to reduce health care subsidies, cut welfare payments and force the unemployed to take jobs in an attempt to rejuvenate Germany's weakened economy. But the proposals have led to noisy protests, especially in eastern Germany, with its 18 percent jobless rate and widespread resentment that life has not improved more since the Berlin Wall fell 15 years ago.

The federal government has pumped hundreds of billions of dollars into the former East Germany since the country was reunified, with politicians repeatedly promising to erase the vast economic disparity between the two sides. Much of the money was wasted on projects that failed to create jobs or lift living standards, however, leading many Germans in the east to fear consignment to second-class status for generations.

Arved Thuemmler, owner of a women's lingerie store in Potsdam, ticked off a list of government-sponsored boondoggles, including an empty semiconductor plant and a half-baked scheme to transport cargo in blimps, as a partial explanation for why he voted for the Greens instead of Schroeder's party.

"If you look at everything they've done, they've thrown it all away," he said. "As a taxpayer, I cannot believe what they've done."

Hajo Funke, a political science professor at the Free University of Berlin, said voter anger was pervasive throughout eastern Germany, making conditions ripe for any party not affiliated with the status quo.

"It's frustration or disappointment with Schroeder's reforms, but more deeply with the whole path taken since reunification," Funke said. "The neo-Nazis can build upon this kind of rage and transform it into a kind of materialistic hatred of foreigners or Jews. You have this kind of scapegoating."

In Brandenburg, the anti-foreigner German People's Union Party relied on slogans such as "German Jobs for Germans First!" to win about 6 percent of the vote -- just above the 5 percent threshold required to be awarded legislative seats.

"The fear of the people about the economy is very deep," Sigmar Peter-Schuldt, the party leader in Brandenburg, said in an interview in the parliament building in Potsdam. "Despite the catastrophic media attacks against us, we have been successful in making voters realize that it is okay to support us."

But Danny Rogler, 31, a gift shop clerk in Potsdam, said he was worried that German history was repeating itself on a smaller scale.

"The big parties don't work together to take care of the problems, so the neo-fascists come in and take advantage," he said. "We had the same thing happen 50 years ago, but nobody wants to remember that."

Special correspondent Shannon Smiley contributed to this report.