Ugandan President, Yoweri Museveni, has won his country's first multi-party polls since 1980, according to official results.
Although Mr Museveni, who came to power in a 1986 coup, was widely expected to win, he received a spirited challenge from Kizza Besigye, his former personal physician and friend.
The Electoral Commission said Mr Museveni had taken 60.8% of the vote to Mr Besigye's 36%, with 91% of ballots counted, making his bid to extend a 20-year hold on power an unannounced certainty.
Opposition leaders have threatened to reject the results, with allegations of widespread irregularities in the vote.
Officials estimate that at least 60% of Uganda's 10.4 million eligible voters turned out on election day, with the relatively peaceful conduct of the poll commended by foreign monitors.
The United States said the poll had been relatively violence-free with few signs of irregularities despite the opposition complaints, although the EU said the vote had been fraught with flaws.
A local democracy watchdog has said it feared up to 200,000 registered voters may have been unable to vote.
The Forum for Democratic Change (FDC), has maintained that Mr Besigye had at least enough support to force Mr Museveni into a second round poll. It also warned of post-election violence, citing voter fears that clashes would erupt and urged politicians to instruct their supporters to remain calm.
The race had been filled with intrigue, spite and criminal allegations, but centred on whether Ugandans wanted a change in leadership amid growing questions about Mr Museveni's commitment to democracy.