Kenya's presidential election has been won by deputy prime minister Uhuru Kenyatta by the slimmest of margins, the election commission has said.
It posted complete results showing that he prevailed with 50.03% of the vote.
That result is likely to bring controversy in Kenya and an almost certain legal challenge from prime minister Raila Odinga.
His supporters took to the streets after the 2007 election after he 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, with the results showing him at 43.3%.
Mr Kenyatta needed to break the 50% barrier to avoid a run-off with Mr Odinga, but he did so by only 4,099 votes out of more than 12.3 million cast.
Monday's presidential vote was the first since the 2007 election sparked two months of tribal 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 Mr Kenyatta could affect Kenya's relations with the West, as he faces charges at the International Criminal Court for his alleged role in directing some of the 2007 post-election violence. His running mate, William Ruto, faces similar charges. The US has warned of "consequences" if Mr 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 Mr Kenyatta is president.
Mr Odinga's camp has indicated legal challenges could be filed. Monday's presidential vote proceeded mostly peacefully, but the counting process has been marred by a series of break-downs and errors.
In order to win outright, Mr Kenyatta must not only get more than 50% of the vote but also at least 25% of the vote in 24 out of Kenya's 47 provinces. Because of the way the election commission announced results, it was difficult to immediately determine if Mr Kenyatta achieved that target.
Mr Kenyatta's ICC trial is set to begin in July and could take years, meaning that if he wins he may have to rule Kenya from The Hague for much of his five-year term. Another option is, as president, to decide not to attend the trial, but that would trigger an international arrest warrant and spark even more damaging effects for Kenya's standing with the West. Mr Kenyatta has promised to report to The Hague, even if he wins the presidency. The ICC yesterday delayed the trial of Mr Ruto until late May.