Kenyan Deputy PM Uhuru Kenyatta appears to have won the presidential election by the tightest of margins as the provisional results indicate.
After all the votes were counted Uhuru Kenyatta had polled 50.03% of the vote, 4,109 votes over the threshold required for outright victory.
However, the official result is not expected before 11:00 on Saturday.
Rival candidate Raila Odinga is set to file a legal challenge if he loses.
One of Raila Odinga’s aides said the candidate had “no intention” of conceding defeat.
Salim Lone told the Daily Nation newspaper: “The level of the failures in the system makes it very difficult to believe it was a credible result, and if Uhuru is declared president, Raila will go to court.”
Both candidates have complained of irregularities during the course of the count, since Monday’s election.
Uhuru Kenyatta won 6,173,433 votes out of a total of 12,338,667, well ahead of the prime minister, who polled 5,340,546 – or 43.28% of the vote.
Uhuru Kenyatta’s Jubilee Coalition party said it was “proud and honored for the trust” bestowed on it, adding that it had taken a message to the people and that “we are grateful to the people of Kenya for accepting this message”.
Early on Saturday, small groups of Kenyatta supporters celebrated in Nairobi, hooting car horns and singing.
If Uhuru Kenyatta is confirmed by Kenya’s Independent Electoral and Boundaries Commission (IEBC), he could face difficult relations with Western countries.
He faces trial at the International Criminal Court (ICC) in The Hague in July for crimes against humanity.
He is accused of fuelling communal violence after the 2007 election that saw more than 1,000 people killed and 600,000 forced from their homes.
Uhuru Kenyatta’s running mate, William Ruto, also faces similar charges.
Both men deny the accusations.
The ICC has agreed to postpone William Ruto’s trial by a month until May after his lawyers complained of not having enough time to prepare his defence.
Countries including the US and UK have hinted that his election as president would have consequences for their relations with the Nairobi government – comments which have been dismissed in Nairobi as unwanted foreign interference in domestic matters.
Kenya’s new electronic voting system was designed to eliminate the chance of vote-rigging and with it any risk of a repeat of the post-poll violence of 2007.
But the count has been plagued with technical glitches, including a programming error that led to the number of rejected votes being multiplied by a factor of eight. By Wednesday, the electronic system was abandoned and the count restarted by hand.
According to Kenya’s election rules, the winner needs to poll more than 50% of the vote to avoid a second round run-off next month.
If the election commission confirms that Uhuru Kenyatta has crossed the 50% threshold by such a narrow margin, then Raila Odinga’s officials say he will challenge the outcome.
The prime minister’s Cord alliance had earlier complained that votes from 11 constituencies were missing, in effect leaving him more than 250,000 votes short.
Both men passed a second condition needed for victory – at least 25% of the vote in more than half of the 47 counties.