* President Hernandez and TV host Nasralla claim victory in vote
* Hernandez pulls ahead by just 3,000 votes
* Both candidates had committed to respecting final outcome (Adds election tribunal being evacuated, tear gas fired)
TEGUCIGALPA, Nov 29 (Reuters) - Honduras faced a growing election crisis on Wednesday, with its U.S.-friendly president edging ahead in troubled vote count that his centrist rival, a television game show host allied with leftists, has rejected, saying he is being robbed.
Three days after polling stations closed in Honduras' presidential election, there was growing international concern with no clear winner and both men claiming victory, despite nearly a fifth of ballots remaining uncounted.
Stricken with poverty, drug gangs and one of the world's highest murder rates, Honduras is one of the United States' closest military and ideological allies in Central America. On Wednesday, the U.S. State Department urged a quick conclusion to the vote count, which has been widely criticized.
Resolution to the festering crisis had appeared possible on Wednesday when both candidates vowed to respect the final result once disputed votes had been scrutinized, issuing identical signed statements brokered by the Organization of American States (OAS).
But the accord did not last long.
Centrist opposition candidate Salvador Nasralla - who had watched with disbelief as his original 5-point lead evaporated, allowing center-right President Juan Orlando Hernandez to edge ahead by 3,000 votes - told reporters that he rejected the document he had signed just a few hours before.
Nasralla cited an hours-long technical glitch at the election tribunal, and fears that Hernandez was planning to unilaterally declare himself victorious, as his reasons for dismissing the results of the electoral body.
"They take us for idiots and want to steal our victory," said Nasralla, who heads a coalition of leftist and centrist parties. "The document I signed today with the OAS has no validity," he added, calling it a "trap" and pledging to take to the streets to defend his votes.
The OAS said in a tweet that it regretted Nasralla had withdrawn from the pact, and that it would continue working for "justice" in the elections.
Later on Wednesday, police fired tear gas to disperse Nasralla supporters gathered outside the election tribunal where the vote was being counted. The fumes entered the building, prompting its staff to be evacuated, television images showed.
With around 82.89 percent of ballots counted, the center-right Hernandez had 42.2 percent of the vote, while Nasralla was on 42.1 percent, the tribunal said. Hernandez's National Party appears set to retain control of Congress.
As he caught his rival, Hernandez's blue-clad supporters celebrated, chanting the president's name at a party base in capital Tegucigalpa, TV images showed, while thousands of Nasralla supporters took to the streets.
"I'm here so that justice and the will of the people is carried out, because we elected Salvador Nasralla, and Juan Orlando Hernandez wants to steal his victory," said 22-year-old David Ramirez, a red political flag draped over his shoulder.
DELAYS, CONCERNS IN WASHGINTON?
The election body published more than half of the results of Sunday's election early on Monday, but faced international criticism for an ensuing 36-hour delay in releasing further data. The count halted again late on Wednesday afternoon.
Tribunal chief David Matamoros apologized to the nation for a fresh computer glitch that derailed operations.
"We've had a problem that we regret and that we didn't expect to have, and that we're resolving as quickly as possible," he said. "Sometimes in an election, you can have a system failure, but never in a moment as critical as this."
International observers said the delays were damaging the credibility of authorities and threatened to undermine the legitimacy of the next president.
On Wednesday, U.S. State Department spokeswoman Heather Nauert urged Honduran authorities to review the election results without delay.
"We urge all candidates to respect the results," she said.
Behind closed doors, the parties of Hernandez, the pre-vote favorite, and Nasralla were discussing immunity from prosecution for current officials and carving up positions in government, two diplomats told Reuters on Tuesday.
With a booming voice and finely coiffed hair, Nasralla is one of Honduras' best known faces, hosting a sports programme and a television game show that features scantily clad women. In one interview, he boasted of his penis size and his sexual performance.
He is backed by leftist former President Manuel Zelaya, who was ousted in a coup in 2009 after he proposed a referendum on his re-election. The possible return of Zelaya risks fueling concern in Washington.
Hernandez has won U.S. praise for helping tackle a flow of migrants to the north and extraditing drug cartel leaders to the United States. He was credited with lowering the murder rate and boosting the economy, but was also hurt by accusations of ties to illicit, drug-related financing that he denies. (Additional reporting by Dave Graham and Frank Jack Daniel; Editing by Rosalba O'Brien and Simon Cameron-Moore)