A fiery union leader won a stunning victory over Shimon Peres in the leadership contest for Israel's Labor Party, officials said Thursday, dealing a blow to the elder statesman that could endanger the country's shaky governing coalition.

Amir Peretz has promised to pull Labor out of Prime Minister Ariel Sharon's government, raising the likelihood of early elections. The defeat also could spell the end of Peres' distinguished, six-decade political career. Peres had been heavily favored to win.

Party secretary Eitan Cabel, announcing Peretz's victory, said the labor leader captured over 42 percent of the vote, while Peres took just under 40 percent. A third candidate, former party head Binyamin Ben-Eliezer, got 17 percent.

The outcome will have deep implications for Sharon's shaky coalition.

Peres, a former prime minister who is now vice premier, wanted to keep Labor in the government until elections scheduled in November 2006.

He led the party into the governing coalition this year to shore up support for Sharon's plans to withdraw from the Gaza Strip. The pullout divided Sharon's Likud Party and without Labor's support, the plan could not have been carried out.

Peretz wants to steer the party back to its socialist roots, pull out of the coalition and force early elections. His message resonated with Israelis disenfranchised by government cuts in social spending and the country's growing gap between rich and poor.

Sharon's Likud Party is deeply divided following the Gaza withdrawal in September. Without Labor's support, he will struggle to keep his coalition intact until the next election, raising the likelihood of early elections.

After the formal victory announcement, a jubilant Peretz, 54, said the party would notify Sharon that it wants to pull out of the government.

"We want to pull out, out of responsibility to Israeli democracy ... and to make the Labor Party an alternative that will return to power in the next elections," he told cheering supporters at party headquarters in Tel Aviv.

He said it was too early to say when Labor would quit the government, but that the party would formulate its position within a few days.

Opinion polls had forecast a resounding victory for Peres in Wednesday's primary. But after two exit polls gave conflicting results, party activists hunkered down for a long night.

Peres called a surprise news conference at 3:15 a.m. to say he suspected fraud had occurred in the vote. Peres did not directly accuse Peretz of foul play, but said reports of wrongdoing had to be checked.

"At this stage, we ask to check the complaints," he said. "We are turning to the legal institutions of the party to look into this."

But party officials rejected the fraud claim, clearing the way for a Peretz victory.

The defeat was a major embarrassment for Peres, who enjoyed double-digit leads in opinion polls, and cemented his image as a perennial loser.

While Peres, a Nobel peace laureate, is widely revered abroad, he has had trouble connecting with Israeli voters and failed in five previous elections for prime minister.

The 82-year-old repeatedly has emerged from the political wilderness. But political analyst Hanan Crystal said the defeat might mark the end of his career.

"This could be his wake. What can he do after this?" Crystal said. He said Peres' other options including becoming Peretz's deputy or splitting off from the party.

Peres believed that remaining in the coalition would let him push forward with peace efforts. Since the Gaza pullout, he has led negotiations with the Palestinians to resolve key disputes, such as control over Gaza's borders, and to help rebuild Gaza's shattered economy.

Peretz said that with the Gaza withdrawal complete, the party should pull out of the government and focus on the economy. Labor has adopted more free-market economic policies in recent years, drawing criticism from its traditional supporters in the unions, working class and farming sectors.

Peretz also could face difficulties within the Labor Party. Pulling out of the coalition will mean that eight senior members will have to step down from coveted positions of government ministers.