Uganda's long-time President Yoweri Museveni has been re-elected, electoral officials say, amid accusations of vote fraud by his main rival Bobi Wine.
Mr Museveni won almost 59% of the vote, with Bobi Wine trailing with about 35%, the Electoral Commission said.
Thursday's poll may turn out to be the "most cheating-free" in the history of the African nation, the president said.
Bobi Wine, a former pop star, vowed to provide evidence of vote-rigging when internet connections were restored.
The government shut down the internet ahead of voting day, a move condemned by election monitors.
They said confidence in the count had been damaged by the days-long cut. A government minister told the BBC on Saturday evening that the internet service would be restored "very soon".
In a phone interview with the BBC World Service, Bobi Wine said he and his wife were not being allowed to leave their home by soldiers.
"Nobody is allowed to leave or come into our house. Also, all journalists - local and international - have been blocked from accessing me here at home," he said.
Dozens of people were killed during violence in the run-up to the election. Opposition politicians have also accused the government of harassment.
The result gives President Museveni a sixth term in office. The 76-year-old, in power since 1986, says he represents stability in the country.
Meanwhile, Bobi Wine - the stage name for 38-year-old Robert Kyagulanyi - says he has the backing of the youth in one of the world's youngest nations, where the median age is 16.
What's the latest on the election results?
"The electoral commission declares Yoweri Museveni... elected President of the Republic of Uganda," election commission chairman Justice Simon Mugenyi Byabakama said on Saturday.
He said turnout was 57% of the almost 18 million registered voters.
Earlier, Mr Byabakama said the vote had been peaceful, and called on Bobi Wine to make public the evidence for his fraud allegations.
The opposition candidate earlier said: "I will be happy to share the videos of all the fraud and irregularities as soon as the internet is restored."
But speaking after being declared the winner, Mr Museveni said: "Voting by machines made sure there is no cheating.
"But we are going to audit and see how many people voted by fingerprints and how many of those voted by just using the register."
Mr Museveni also warned that "foreign meddling will not be tolerated".
The EU, United Nations and several rights groups have raised concerns. Aside from an African Union mission, no major international group monitored the vote.
Earlier this week the US - a major aid donor to Uganda - cancelled its diplomatic observer mission to the country, saying that the majority of its staff had been denied permission to monitor polling sites.
The US state department said the vote occurred in "an environment of intimidation of fear".
Bobi Wine will continue to play a role
By Catherine Byaruhanga, BBC News, Kampala
President Yoweri Museveni has seen off countless challengers during his three decades in power - helped along by constitutional changes, which have allowed him to continue running for office.
His assurances of security and economic stability continue to win him votes. It's easy to underestimate how much the memories of decades of civil war and a failed state still cast a shadow over this country.
Bobi Wine rejects the results and says he will present evidence of rigging and voter intimidation. The opposition leader casts a lonely figure - in his home on the outskirts of Kampala.
His key advisers have either been arrested or are in hiding. Nevertheless, he will continue to play a key role in Uganda's politics.
His National Unity Platform is expected to be the biggest opposition party in parliament. What he says and does can inspire millions both in Uganda and across Africa where youthful political movements are taking hold.
Who is Yoweri Museveni?
Mr Museveni, who came to power on the back of an armed uprising in 1986, stood as leader of the National Resistance Movement (NRM).
He has long been depicted to Ugandans as a liberator and peace bringer.
But he has managed to maintain his grip on power through a mixture of encouraging a personality cult, employing patronage, compromising independent institutions and sidelining opponents, says the BBC's Patience Atuhaire.
Who is Bobi Wine?
The reggae star is known by his supporters as the "ghetto president".
His party, the National Unity Platform (NUP), campaigns for basic needs like improving access to healthcare, education, clean water and justice.
Over the last two decades Bobi Wine's musical output has been filled with songs about these issues and they have inspired a fervent following.
He grew up in Kampala's Kamwokya slum where he went on to build his now world-famous recording studio.
Credit: The BBC