Kenya election: Uhuru Kenyatta hails 'democracy triumph'
Newly elected Kenyan President Uhuru Kenyatta has hailed his poll win as a "triumph of democracy" and peace.
After being declared winner of Monday's poll by the slimmest of margins - 50.07% - Mr Kenyatta said voters had upheld "respect for the rule of law", and promised to work with opponents.
However his main rival, Raila Odinga, vowed to challenge the result in court.
Mr Kenyatta is set to be tried at the International Criminal Court over violence that followed the 2007 polls.
He is accused of fuelling the communal violence that saw more than 1,000 people killed and 600,000 forced from their homes.
On Saturday the election commission said Mr Kenyatta had narrowly avoided a run-off by winning 50.07% of votes in a credible and transparent poll.
It said the turnout, at 86%, was the largest ever in the country.
The BBC's Gabriel Gatehouse in Nairobi says it was the closest of races with the tightest of margins.
After the results were announced, Mr Kenyatta told cheering supporters he would serve all Kenyans "without fear or favour".
Speaking at the Catholic University in Nairobi, he said Kenyans were celebrating the "triumph of democracy, the triumph of peace, the triumph of nationhood".
Voters, he said, had "demonstrated a level of political maturity that surpassed expectations", and he called on Mr Odinga and other leaders to "join us in moving our nation forward".
However Mr Odinga, the current prime minister, said the election commission had "failed Kenyans" and that democracy itself was "on trial".
He announced that he would challenge the results of a "tainted election" in the Supreme Court.
He also appealed for calm, saying: "Any violence could destroy this nation forever."
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.
Mr Odinga's Cord alliance had earlier complained that votes from 11 constituencies were missing, in effect leaving him more than 250,000 votes short.
How Mr Odinga now handles his supporters will determine whether his dispute stays in the courts or spills out on the streets, our correspondent says.
Western powers welcomed the peaceful vote but avoided mentioning Mr Kenyatta.
Ahead of the election, the US and the UK had hinted that his election would complicate relations because of the charges of crimes against humanity he faces.
US Secretary of State John Kerry called the election a "historic moment" and said America would "continue to be a strong friend and ally" of the Kenyan people.
The British Minister for Africa, Mark Simmonds, urged all sides to show restraint.
In July Mr Kenyatta is due to go on trial at the International Criminal Court (ICC) in The Hague
His running mate, William Ruto, also faces similar charges. Both men deny the accusations.
In his victory speech, Mr Kenyatta restated his promise to co-operate "with all nations and international institutions".
The ICC has agreed to postpone Mr Ruto's trial by a month until May after his lawyers complained they did not have enough time to prepare his defence.