Kenya’s Supreme Court has upheld Uhuru Kenyatta’s presidential election victory, rejecting several petitions challenging the vote.
Chief Justice Willy Mutunga announced the decision, which was unanimous, saying the poll was free and fair.
The appeal was lodged by PM Raila Odinga, Mr Kenyatta’s main rival in the presidential poll this month.
Official results said Mr Kenyatta beat Mr Odinga by 50.07% to 43.28%, avoiding a run-off by just 8,100 votes.
There was tight security at the Supreme Court as the judgement was read out. Violence after a disputed election in 2007 left more than 1,200 people dead.
The presidential, legislative and municipal elections held on 4 March were the first since the 2007 poll.
Mr Kenyatta and his running mate, William Ruto, will be sworn in as president and vice-president early next month.
But they are facing trial on charges of crimes against humanity at the International Criminal Court (ICC) for allegedly fuelling unrest after that election. They deny the charges.
Plea for calm
Chief Justice Mutunga said the court’s decisions had been unanimous on all the issues they were asked to rule on.
He said that Mr Kenyatta and Mr Ruto had been “validly elected” in a poll carried out in a “free, fair, transparent and credible” manner.
“It is the decision of the court that the said elections were indeed conducted in compliance with the constitution and the law,” he said.
“At this historical moment in our country, the Supreme Court has discharged its constitutional duty in conformity with the solemn oath each one of us took,” he added.
“It is now for the Kenyan people, their leaders, civil society, the private sector and the media to discharge theirs, to ensure that the unity, peace, sovereignty and prosperity of the nation is preserved. God bless Kenya.”
Before he delivered the ruling, all roads leading to the building were closed.
The BBC’s Gabriel Gatehouse in Nairobi says police used teargas to chase away protesters but the area outside the court is now quiet.
Police chief David Kimaiyo warned on Friday that unrest would not be tolerated.
He said: “We have reports indicating that some parties have organised their supporters to converge outside the Supreme Court during delivery of the ruling, and we will not allow any such gatherings.
“There will be tight security in all parts of the country, we will not tolerate any form of violence.”
Outgoing President Mwai Kibaki has urged people to stay calm and accept the result, but much will depend on Kenyans’ faith in their newly reformed judiciary, our correspondent says.
Petitions had been filed to the court by Mr Odinga and by civil society groups, who claimed irregularities had affected the election result and called for fresh elections.
Mr Odinga’s response to the ruling is critical, as is the question of whether he will now end his career in politics, correspondents say.
On Friday, the Supreme Court reviewed recounts from 22 polling stations. Both sides claimed that the recounts vindicated their position.
Mr Kenyatta has called the election, which was largely conducted peacefully, a “triumph of democracy”.
The Independent Electoral and Boundaries Commission (IEBC) has insisted that the vote was credible, despite technical failures with an electronic voter ID system and the vote counting mechanism.
International observers said the poll was largely free, fair and credible, and that the electoral commission had conducted its business in an open and transparent manner.