Venezuela's acting President Nicolas Maduro was declared the winner of the election to succeed his late mentor Hugo Chavez by a razor-thin margin late Sunday, but his rival refused to concede defeat.
The contested result plunged the deeply divided oil-rich South American country into uncertainty, with the handpicked heir of Chavez's socialist revolution declaring victory and opposition leader Henrique Capriles demanding a recount.
Fireworks erupted after the National Electoral Council announced that the "irreversible" results showed Maduro had won with just 50.66 percent of the vote compared to 49.1 percent for Capriles -- a difference of less than 300,000 votes.
"Mission accomplished Comandante Chavez. The people fulfilled its pledge," Maduro said in front of cheering supporters at the Miraflores presidential palace.
The 50-year-old former foreign minister declared that he secured a "fair, legal, constitutional" victory. But he said he was open to an audit of the close vote tally. He is scheduled to be sworn-in to complete Chavez's six-year term on Friday.
Maduro said he spoke with Capriles by telephone and that he told his rival he must recognize the outcome of the election. Both candidates had pledged during the campaign to accept the results.
But Capriles -- who had accepted defeat when Chavez beat him by 11 points in October polls -- held up a list of some 3,200 "incidents" that took place during the vote.
"Today's loser is you," he told a news conference, referring to Maduro, adding: "We won't recognize a result until every vote has been counted."
The 40-year-old state governor wants a recount of the backup paper ballots that are printed out by the electronic voting machines.
Hours earlier, Capriles charged that there were attempts to let people vote after polling stations closed. He also accused the government of pressuring civil servants to vote for Maduro.
Some Capriles supporters fought back tears at his campaign headquarters.
"I'm exasperated because we worked a lot in this campaign for a better future and I don't accept the results of the electoral council," said Daniela Brito, a 19-year-old university student with tears in her eyes.
But National Electoral Council president Tibisay Lucena said the results were "irreversible" after 99 percent of electronic votes were counted, with 78.7 percent turnout.
Luis Vicente Leon, director of the Datanalisis polling firm, wrote on Twitter that the opposition's rejection of the results "was within the legal framework and does not represent a risk of conflict in the street."
Named by Chavez as his political heir, Maduro rode a wave of grief for the late leader, who ruled Venezuela for 14 years with a socialist revolution that made him popular among the poor while disenchanting others fed up with the weak economy.
Opinion polls had given Maduro leads of 10 to 20 points during the campaign, but Capriles energized the opposition in his second shot at the presidency after 14 years under Chavez.
Maduro has vowed to continue the oil-funded policies that cut poverty by almost half to 29 percent through popular health, education and food programs.
But Chavez left behind a litany of problems: South America's highest murder rate, with 16,000 people killed last year, chronic food shortages, high inflation and recurring power outages.
Hundreds of Chavistas began to celebrate in front of the presidential palace well before the results were announced, launching fireworks, dancing and holding pictures of Maduro and Chavez.
"This is a very important victory for the future of the country. This is the legacy of our comandante, who is no longer here. But he left us Maduro and he will defend his project," said Rafael Perez Camarero, 29.
Capriles had graciously accepted his defeat when Chavez beat him in October polls that marked the opposition's best showing against the late leader. Sunday's result against Chavez's handpicked heir was far closer.
Maduro inherited Chavez's formidable electoral machinery, which helped the late leader win successive elections in 14 years, with government employees often seen handing campaign pamphlets and attending rallies in groups.
After voting in Caracas earlier in the day, Maduro warned there would be no dialogue with the "bourgeoisie" -- his term for the opposition -- and took a shot at the United States, saying he would present evidence of US interventionism on Monday.
His candidacy was backed by Chavez's leftist allies in the region, especially communist Cuba, whose anemic economy has been kept afloat by generous oil shipments from a nation sitting on the world's biggest crude reserves.