Uhuru Kenyatta, the son of Kenya's founding president, won the presidential election by a tiny margin, with 50.03 per cent, a result that his rival says he now intends to challenge in court. Mr Kenyatta faces trial for crimes against humanity after the disputed 2007 presidential vote which unleashed tribal bloodletting.
If he is declared the winner by the election commission, which has still to announce the official result, Kenya will become the second African country after Sudan to have a sitting president indicted by the International Criminal Court. The United States and other Western states said before the vote that a Kenyatta win would complicate diplomatic ties with a nation viewed as a vital ally in the regional battle against militant Islam.
From the early hours of Saturday, Mr Kenyatta's supporters thronged the streets of Nairobi and his tribal strongholds. But tensions rose in the heartlands of Mr Kenyatta's rival, Prime Minister Raila Odinga, who had 43.28 per cent of votes. "No Raila, no peace," Odinga supporters chanted as security forces stood by in Kisumu, where violence flared in 2007.
An adviser to Mr Odinga, who lost in 2007, said his candidate would not accept the result and will launch a legal challenge. "He is not conceding the election," Salim Lone told Reuters. Mr Odinga's camp had said that the ballot count was deeply flawed and had called for it to be halted. But it promised to pursue any disputes in the courts, not the streets.
International observers broadly said the vote and count had been transparent so far and the new electoral commission promised a credible vote. To win in the first round, a candidate needed more than 50 per cent of the votes. Mr Kenyatta, the deputy prime minister, achieved that but with a margin of only 4,100 votes of the more than 12.3 million ballots cast. Provisional figures displayed by the electoral commission showed that Mr Kenyatta won 6,173,433 votes out of a total of 12,338,667 ballots cast. Mr Odinga won 5,340,546 votes. The election commission, plagued by technical problems that slowed the count, took five days to announce the result.
Mr Odinga, 68, said he would have conceded if the vote was fair, adding that there was "rampant illegality" in the electoral process and that "democracy was on trial in Kenya".
"Any violence now could destroy this nation for ever, but it would not serve anyone's interests," he said. Both sides relied heavily on their ethnic groups in a nation where tribal loyalties mostly trump ideology at the ballot box. Mr Kenyatta is a Kikuyu, the biggest of Kenya's many tribes; Mr Odinga is a Luo.
How Western capitals deal with Kenya under Mr Kenyatta will depend on whether he and his running mate, William Ruto, who is also indicted, co-operate with the tribunal. Both Mr Kenyatta and Mr Ruto deny the charges and have said they will work to clear their names, though Mr Kenyatta had to fend off jibes that he would have to run government by Skype from The Hague.
Kenyans are hoping that this vote, which has until now passed off with only pockets of unrest on voting day, will restore their nation's reputation as one of Africa's most stable democracies. The bloody upsurge after the last election left more than 1,200 dead. Church leaders in Kisumu, in the west of Kenya, which was devastated five years ago, sought to defuse tension this time. Many shops stayed closed as a precaution in Mombasa, another Odinga stronghold, but streets were calm.
Mr Odinga's camp had said even before the result that it was considering a court challenge. In contrast, in 2007, he said he could not trust the judiciary to act fairly.