CARACAS, Venezuela (AP) -- Hugo Chavez's hand-picked successor, Nicolas Maduro, won a razor-thin victory in Sunday's special presidential election but the opposition candidate refused to accept the result and demanded a full recount.
Maduro's stunningly close victory followed an often ugly, mudslinging campaign in which the winner promised to carry on Chavez's self-styled socialist revolution, while challenger Henrique Capriles' main message was that Chavez put this country with the world's largest oil reserves on the road to ruin.
Despite the ill feelings, both men sent their supporters home and urged them to refrain from violence.
Maduro, acting president since Chavez's March 5 death, held a double-digit advantage in opinion polls just two weeks ago, but electoral officials said he got just 50.7 percent of the votes to 49.1 percent for Capriles with nearly all ballots counted.
The margin was about 234,935 votes. Turnout was 78 percent, down from just over 80 percent in the October election that Chavez won by a nearly 11-point margin over Capriles.
Chavistas set off fireworks and raced through downtown Caracas blasting horns in jubilation. But analysts called the slim margin a disaster for Maduro, a former union leader and bus driver in the radical wing of Chavismo who is believed to have close ties to Cuba.
In a victory speech, he told a crowd outside the presidential palace that his victory was further proof that Chavez "continues to be invincible."
But in a hint of discontent, National Assembly President Diosdado Cabello, who many consider Maduro's main rival, expressed dismay in a tweet: "The results oblige us to make a profound self-criticism. It's contradictory that the poor sectors of the population vote for their longtime exploiters."
At Capriles' campaign headquarters, people hung their heads quietly as the results were announced by an electoral council stacked with government loyalists. Many started crying; others just stared at TV screens in disbelief.
Later, Capriles emerged to angrily reject the official totals: "It is the government that has been defeated."
He said his campaign came up with "a result that is different from the results announced today."
"The biggest loser today is you," Capriles said, directly addressing Maduro through the camera. "The people don't love you."
Armed forces joint chief, Gen. Wilmer Barrientos, called on the military to accept the results.
A Capriles' campaign staffer told The Associated Press on condition of anonymity that the candidate met with the military high command after polls closed. But campaign official Armando Briquet later denied a meeting was held.
Capriles, an athletic 40-year-old state governor, had mocked and belittled Maduro as a poor, bland imitation of Chavez.
Maduro said during his victory speech that Capriles had called him before the results were announced to suggest a "pact" and that Maduro refused. Capriles' camp did not comment on Maduro's claim.
Maduro, a longtime foreign minister to Chavez, rode a wave of sympathy for the charismatic leader to victory, pinning his hopes on the immense loyalty for his boss among millions of poor beneficiaries of government largesse and the powerful state apparatus that Chavez skillfully consolidated.
Capriles' main campaign weapon was to simply emphasize "the incompetence of the state."
Millions of Venezuelans were lifted out of poverty under Chavez, but many also believe his government not only squandered, but plundered, much of the $1 trillion in oil revenues during his 14-year rule.
Venezuelans are afflicted by chronic power outages, crumbling infrastructure, unfinished public works projects, double-digit inflation, food and medicine shortages, and rampant crime -- one of the world's highest homicide and kidnapping rates -- that the opposition said worsened after Chavez disappeared to Cuba in December for what would be his final surgery.
Analyst David Smilde at the Washington Office on Latin America think tank predicted the victory would prove pyrrhic and make Maduro extremely vulnerable.
"It will make people in his coalition think that perhaps he is not the one to lead the revolution forward," Smilde said.
"This is a result in which the 'official winner' appears as the biggest loser," said Amherst College political scientist Javier Corrales. "The 'official loser' -- the opposition -- emerges even stronger than it did six months ago. These are very delicate situations in any political system, especially when there is so much mistrust of institutions."
Many across the nation put little stock in Maduro's claims that sabotage by the far right was to blame for worsening power outages and food shortages in the weeks before the vote.
"We can't continue to believe in messiahs," said Jose Romero, a 48-year-old industrial engineer who voted for Capriles in the central city of Valencia. "This country has learned a lot and today we know that one person can't fix everything."