Kenya's elections chief declared Deputy President William Ruto the winner of a tight presidential race on Monday.
However, some senior election officials disowned the result, fuelling fears of violence like that seen after previous disputed polls.
Hailing the electoral commission as "heroes", Ruto said "There is no looking back. We are looking to the future. We need all hands on deck to move forward."
The 55-year-old had made Kenya's class divisions the centrepiece of his campaign to become Kenya's fifth president, promising to reward low-income "hustlers" and pouring scorn on Kenya’s political dynasties.
That was a barely veiled jab at his opponent Raila Odinga and President Uhuru Kenyatta, son of the nation's first vice president and president, respectively.
Ruto, who heads the Kenya Kwanza (Kenya First) Alliance, had appeared to be leading long-time opposition leader Odinga as Kenyans awaited final results of the election held nearly a week ago.
Minutes before the chairman of the electoral commission Wafula Chebukati announced that Ruto had won the vote, his deputy Juliana Cherera had told media at a separate location that she and three other commissioners disowned the results.
"We are not able to take ownership of the results that will be announced, because of the opaque nature of this last phase of the general election," she said.
The electoral commission has seven commissioners.
Diplomats and international observers were whisked out of the tallying hall before Chebukati spoke, as scuffles broke out.
Before announcing Ruto as the winner, Chebukati said two commissioners and the electoral commission's Chief Executive had been injured and were being treated.
Chebukati said Ruto had won 50.49 per cent of the vote, against Odinga's 48.5 per cent.
The winning candidate must get 50 per cent of votes plus one.
Odinga did not attend the announcement.
Amid fears that vote-rigging allegations could lead to bloody scenes like those that followed presidential polls in 2007 and 2017, Cherera urged the parties to pursue any disputes through the courts.
The electoral commission has introduced many checks and balances to try to prevent disputes like those that led to violence in which more than 1,200 people were killed following the 2007 election.
In 2017, more than 100 people were killed after the Supreme Court quashed the initial result over irregularities in the electoral process.
The next president will have to confront an economic and social crisis in East Africa's most advanced economy, where poor Kenyans already reeling from the impact of COVID-19 have been hit by global rises in food and fuel prices.
The worst drought for 40 years has devastated the country's north, leaving 4.1 million people dependent on food aid, while its debt levels have soared.
Kenyatta, who has served his two-term limit as president, fell out with Ruto after the last election and this time endorsed Odinga, making his fifth stab at the presidency.
In Kisumu, an Odinga stronghold in the west of the country, the reaction was immediate.
Several plumes of black smoke rose around a roundabout as people burned piles of tires.
Amid shouts of "We need Raila now!", "Chebukati must go!" and "No Raila, no peace!", motorcycle drivers honked their horns and people blew into vuvuzelas and whistles.
By contrast, the mood in Eldoret - Ruto's home turf - was ecstatic.
"We are very happy. I believe in the leader who was selected, I believe in the IEBC (the electoral commission)," said 25-year-old Eldoret resident Kenneth Kibitok.
"He is about the bottom up. People from down there will be up here," said Kibitok, who had spent all day on a stretch of Eldoret sidewalk popular with Kenyans who like discussing politics.