Kenya's election commission announced early Saturday that Deputy Prime Minister Uhuru Kenyatta prevailed in the country's presidential elections by the slimmest of margins, winning 50.03 per cent of the vote.

That result is likely to bring controversy in Kenya and an almost certain legal challenge from Prime Minister Raila Odinga. Kenyatta needed to break the 50 per cent barrier to avoid a run-off with Odinga, but he did so by only 4,099 votes out of more than 12.3 million cast.

Monday's vote was the first since Kenya's 2007 election sparked two months of tribe-on-tribe violence after a disputed election win was claimed by President Mwai Kibaki. More than 1,000 people were killed in attacks that included machetes, bows and arrows and police firearms.

A win by Kenyatta could greatly affect Kenya's relations with the West. Kenyatta faces charges at the International Criminal Court for his alleged role in directing some of Kenya's 2007 post-election violence. His running mate, William Ruto, faces similar charges.

The U.S. has warned of "consequences" if Kenyatta, the son of Kenya's founding father, wins, as have several European countries. Britain, which ruled Kenya up until the early 1960s, has said they would have only essential contact with the Kenyan government if Kenyatta is president.

Odinga's camp has indicated legal challenges could be filed. Monday's presidential vote proceeded mostly peacefully, but the counting process has been stymied by a myriad of break-downs and errors.

That the winner was quietly revealed overnight — at about 2:35 a.m. local time — came as somewhat of a surprise. Around midnight the electoral commission said it would give a formal announcement of the winner at 11 a.m. Kenya time Saturday. There was a belief among observers that the decision was made in part not to make a night-time announcement that could stir suspicions and put security forces at a disadvantage if rioting broke out.

Diplomats said they believed Odinga was not likely to protest the vote in a manner that would increase the chances of violence, but rather honor his pledge to respect the result and petition the courts with any grievances. Odinga scheduled a news conference for later Saturday morning.

The Kenyan capital has been sleepy since Monday's vote for president, the country's first election since its 2007 vote sparked tribe-on-tribe violence that killed more than 1,000 people. But security forces in riot gear took to the streets Friday in regions of the city that could turn tumultuous after results are announced.

The prime minister's supporters took to the streets in 2007 after Odinga said he had been cheated. In Kibera, Nairobi's largest slum and a bastion of Odinga support, many believe this year's results have been rigged as well.

"If you look at the way the tallying is being done there is rigging," said Isiah Omondi, 27. "If Uhuru wins and wins fairly, we don't have a problem with him. He can be our president. But not like this."