Ugandan election officials are counting votes after the first multi-party presidential and parliamentary elections in 25 years.
Voters used plastic bowls for privacy while filling in their ballot papers
Long lines of voters were still waiting when polling stations closed but they were allowed to cast their ballots.
Some opposition activists said their names were missing from the electoral roll and they were not allowed to vote.
Incumbent Yoweri Museveni and Kizza Besigye are the favourites among five presidential candidates.
Turnout was reportedly high, despite interruptions from heavy rains at outdoor polling stations.
Dr Besigye has complained of intimidation and harassment after being arrested and jailed last year on charges of treason and rape.
Opinion polls suggest a close contest between Mr Museveni and Dr Besigye in the presidential race. Results are to be declared by Saturday.
The main rivals are Kizza Besigye (l) and Yoweri Museveni (r)
A candidate needs more than 50% to win, or the two front-runners will contest a second round.
In one polling station in the war-torn northern district of Gulu, Dr Besigye got 235 votes, while Mr Museveni got just nine, raising loud cheers from the crowd outside.
The BBC's Julian Marshall at a polling station in the capital, Kampala, says anger is growing because hundreds of people have been unable to vote.
One man said he had been queuing all day to vote but had been barred because his name was not on the electoral roll.
He said he had checked his name previously and had been given a voting card.
The ruling National Resistance Movement denied opposition allegations of fraud, calling Dr Besigye's party "bad losers", Reuters news agency reports.
A police spokesman told said there had been no reports of significant violence, the AP news agency says.
Security is heavy, with 12,000 army reserves deployed at nearly 20,000 polling stations.
About 10.4m people were registered to vote. They were also choosing 284 members of parliament on Thursday.
As Dr Besigye arrived to vote in the western district of Rukungiri, he found some unsealed ballot boxes, sparking arguments with election officials.
Mr Museveni said he was confident of victory in the first round, as he cast his vote in Kirihura also in the west.
Mr Museveni had been seen as leading a "new generation" of African leaders but was criticised for changing the constitution to let him contest these polls after being in power for 20 years.
However, he has been praised for raising living standards and improving security after years of misrule under Idi Amin and Milton Obote.
On the eve of the poll, he warned that voting was "not a joke".
"It is a matter of life and death. If you decide wrongly, you will bear the consequences," he said in a national address on state-run radio and television.
Dr Besigye used to be Mr Museveni's personal doctor but the pair fell out and were election rivals in 2001.
The BBC's Will Ross, in Kampala, says the rift between the two has grown so large they both say they have not exchanged a single word for more than six years.