Uganda's president Yoweri Museveni has won a sixth term in office, election officials have confirmed, despite his top challenger Bobi Wine dismissing the results as "cooked-up" and "fraudulent".
Polling chiefs also struggled to explain how the results of the election were compiled amid an internet blackout.
But 76-year-old Museveni, in power since 1986, dismissed the allegations of fraud in an evening address to the nation, saying Thursday's election may turn out to be the "most cheating free" in Uganda's history.
In a generational clash watched across the African continent, the 38-year-old singer-turned-legislator Wine was arguably Museveni's greatest challenge yet in almost 35 years in power.
The self-styled "ghetto president", Wine enjoyed strong support in urban centres where frustration with unemployment and corruption is high. He has claimed victory.
In a phone interview from his home, which he said was surrounded by soldiers, Wine urged the international community to "please call General Museveni to order" by withholding aid, imposing sanctions and using Magnitsky legislation to hold alleged human rights abusers accountable.
Wine repeated that all legal options are being considered, including challenging the results in court, and called for peaceful protests.
Uganda's electoral commission said Museveni received 58 per cent of the vote and Wine 34 per cent, with voter turnout at 52 per cent in a process which the top US diplomat to Africa called "fundamentally flawed".
Wine has said he is alone with his wife, Barbie, and a single security guard after police told a private security company to withdraw its protection ahead of Thursday's election.
He said he will not leave Uganda and abandon its 45 million people to the kind of treatment he has faced.
The vote followed the East African country's worst pre-election violence since Museveni took office in 1986.
Wine and other candidates were beaten or harassed, and more than 50 people were killed when security forces put down riots in November following Wine's arrest.
Wine, whose real name is Kyagulanyi Ssentamu, was detained several times while campaigning but never convicted. He said he feared for his life.
In response to his allegations of vote-rigging, Uganda's electoral commission said Wine should prove it. Wine says he has video evidence and will share it once internet access is restored.
The commission also deflected questions about how countrywide voting results were transmitted during the internet blackout by saying "we designed our own system".
Tracking the vote was further complicated by the arrests of independent monitors and the denial of accreditation to most members of the American observer mission, leading the US to call it off.
Tibor Nagy, the top US diplomat for Africa, tweeted: "Uganda's electoral process has been fundamentally flawed."
He called for the immediate and full restoration of internet access, and warned that that "the US response hinges on what the Ugandan government does now".
Museveni, once praised as part of a new generation of African leaders and a long-standing US security ally, still has support among some in Uganda for bringing stability.
The UK called for the concerns about the election to be investigated.
"It is important these concerns are raised, investigated and resolved in a peaceful, legal and constitutional manner," Britain's minister for Africa James Duddridge said.
Uganda's elections are often marred by allegations of fraud and abuses by security forces.
Australian Associated Press