NAIROBI (Reuters) - Kenya's Supreme Court upheld Uhuru Kenyatta's presidential election victory on Saturday and his defeated rival accepted the ruling, helping douse tensions after tribal violence blighted the election five years ago.
The decision cleared the way for Kenya's richest man to take the top job in east Africa's biggest economy, but left Western powers with the headache of dealing with a leader charged with crimes against humanity at the International Criminal Court.
After the judgment, police fired shots in the air and tear gas at hundreds of stone-throwing youths in the western city of Kisumu, a stronghold of defeated candidate Raila Odinga, who had challenged Kenyatta's win. Protesters looted shops and burned tyres in the city that was a flashpoint five years ago.
An official at Kenya's Red Cross said two people were killed from gunshots, and 11 others were wounded. But the violence was less severe than after the 2007 election.
And shortly after the court ruling, Odinga delivered a televised statement accepting the court's unanimous decision.
"The court has now spoken," Odinga said. "I wish the president-elect, honourable Uhuru Kenyatta, and his team well."
Western donors, worried about a nation seen as a vital ally in the regional battle against militant Islam, also congratulated Kenyatta. But they have said his indictment in the Hague will complicate their relations.
There was no immediate sign of major flare-ups in other areas of Kenya blighted by violence after the disputed ballot in 2007 that triggered bloodshed and killed more than 1,200 people.
During a 10-minute session to read the ruling, Chief Justice Willy Mutunga said the six-member court had reached the unanimous decision that Kenyatta and his running mate for deputy president, William Ruto, had been "validly elected".
"It is now for the Kenyan people, their leaders, civil society, the private sector and the media to discharge (their duty), to ensure that the unity, peace, sovereignty and prosperity of the nation is preserved," he said.
After a week of hearings, he said the court ruled that the March 4 vote was conducted in a free, fair and credible manner.
Many Kenyans said they were determined to avoid a re-run of the violence five years ago and that, this time round, they had more trust in the newly reformed judiciary and the chief justice, Mutunga, a well-respected lawyer appointed in 2011.
Kenyatta, in a televised address, thanked the court for its work and also Odinga for wishing him well. The president-elect promised his government would "work with and serve all Kenyans without any discrimination whatsoever."
"MADE KENYA PROUD"
Peaceful voting in this year's vote, and the fact the dispute was played out by lawyers not machete-wielding gangs, has helped repair Kenya's image.
Paramilitary police, some on horseback, formed a security cordon around the court before the ruling, keeping back a few dozen Odinga supporters who had defied a ban on rallies.
After the ruling, Kenyatta's backers ignored the rain and took to Nairobi's streets cheering. Cars hooted their horns.
Twitter lit up after the decision, with many saying it was time for Kenya to move on. Judith Sidi Odhiambo praised the chief justice: "You have made Kenya proud and restored our dignity. Well done. We can now move ahead as a nation."
Kenyatta comfortably beat Odinga in total votes won, but only just avoided a run-off by edging above the 50 percent mark.
Kenyatta is facing charges of crimes against humanity in the Hague-based court, accused of helping incite violence after the 2007 vote. Kenyatta denies the charges and has promised to cooperate with the court to clear his name.
In Washington, the White House issued a statement congratulating Kenyatta on his victory.
It said: "We also congratulate the people of Kenya on the peaceful conduct of the election and commend Raila Odinga for accepting the Supreme Court's decision. We urge all Kenyans to peacefully accept the results of the election."
British Prime Minister David Cameron wrote to Kenyatta to congratulate him. European Commission President Jose Manuel Barroso sent a congratulatory message that also welcomed the new government's commitment to abiding by international obligations.
That referred to Kenyatta's acceptance speech on March 9 in which he promised to cooperate with international bodies but - in an apparent swipe at the West - said the world should also respect the democratic will of Kenyans.
Western nations have a policy of only "essential contacts" with court indictees. They say that will not affect dealings with the government as a whole, but will worry the issue could drive a long-time ally closer to emerging powers such as China.
Ahead of the ruling the Kenyan shilling had been trading in a tight range to the U.S. dollar and traders said it could strengthen if the ruling upheld Kenyatta's victory.
(Additional reporting by Joseph Akwiri in Mombasa, Hezron Ochiel in Kisumu and Humphrey Malalo in Nairobi; Writing by Edmund Blair; Editing by Stephen Powell)