(CNN) — The Kenyan Supreme Court on Saturday upheld Uhuru Kenyatta's victory in the presidential election, dismissing a challenge by his chief rival.
The Supreme Court declared the election "free and fair."
Kenyatta, the 51-year-old son of Kenya's founding leader, won the election this month with 50.07% of the vote.
The court's decision means he will become the nation's fourth and youngest president.
Prime Minister Raila Odinga, who got 43.31% of the vote, had challenged the outcome in court on the grounds that it was flawed and marred by technical problems.
He said that he accepted the court's judgment and would abide by it.
Odinga said his challenge was born of his dismay over the failures seen in the election, which was dogged by technical problems. "Democracy was on trial in Kenya," he said.
"That has not dented my commitment to constitutionalism and the rule of law. Enforcing the spirit and letter of the constitution remains the only sure way to peace and prosperity for our young democracy.
"My decision to file a petition in the Supreme Court to challenge the validity of the election was a testament of my faith in the independence of our judiciary. I did so for the sake of our democracy and for the sake of all Kenyans."
As the nation awaited the verdict, anti-riot police guarded the court in the capital of Nairobi while crowds hovered nearby.
Authorities stepped up security nationwide, and warned that gatherings are prohibited.
U.N. Secretary-General Ban Ki-moon talked afterward with both Kenyatta and Odinga, pledging the United Nations' "strong support" for Kenya's government and its people.
"The secretary-general reiterates his congratulations to the people of Kenya on the holding of peaceful, credible elections that should strengthen Kenya's democracy and its unity," a statement from Ban's office said. "He urges that continued calm and a peaceful atmosphere prevail."
White House press secretary Jay Carney similarly lauded "the peaceful conduct of the election" in Kenya and congratulated Kenyatta.
Last week, the nation's highest court ordered a review of the results of 22 of the more than 33,000 polling stations after Odinga's lawyers said they had found discrepancies. The electoral commission has said that while the vote was marred by technical glitches, it was credible.
Kenyatta and Odinga are the sons of the nation's first president and vice president, respectively, bringing back memories of a political dynasty that dates to the 1960s.
Their fathers started out as allies in the quest for Kenyan independence from Britain. But the elder politicians' relationship ended in bad blood when founding President Jomo Kenyatta forced out his vice president, Jaramogi Odinga, following a series of disputes.
Some five decades later, it is the sons' turn in the spotlight.
'Accept the ruling'
A peaceful response to Saturday's judgment will go a long way toward restoring the nation's image as a bastion of stability in the region after disputed election results led to bloody chaos in 2007.
In that election, more than 1,200 were killed and hundreds of thousands displaced after Odinga disputed the results, which showed incumbent President Mwai Kibaki as the winner.
At the time, supporters of both candidates battled on the streets with crude weapons, not in court.
"As the country awaits the Supreme Court ruling, I call upon all of us to accept the ruling and maintain peace," said Kibaki, the outgoing president, on Thursday.
"Kenyans should resume their routine economic activities as soon as possible to return normalcy in the country."
The March 4 election was the first general poll since the disputed election. It was conducted under a reformed judicial system and a more inclusive electoral commission.
The significance of Kenya's democratic process extends beyond the country's borders.
Kenya is East Africa's biggest economy and a crucial trade route into the rest of the continent.
It provides an important buffer of stability in a region that includes the fledgling Somali government and the politically tense Sudan and South Sudan.
Kenya is also a major U.S. ally in the war against Islamist militants in the region and has remained relatively peaceful amid civil wars in neighboring nations.
The upholding of Kenyatta's victory raises the prospect of complicated diplomatic ties with the West.
The International Criminal Court has indicted him for allegedly funding a local militia that conducted reprisal attacks in the last election in 2007. His running mate, William Ruto, also faces ICC charges at The Hague, in the Netherlands.
Both have denied the charges and have said they will cooperate with the court to clear their names.
Analysts say the ICC indictment may have rallied citizens to Kenyatta's side in defiance of the West.
"Many Africans have lost faith in ICC and view it as targeting African leaders and failing to discharge its justice among non-African leaders," said Ayo Johnson, director of ViewPoint Africa. "Kenya sent a loud message to the ICC ... don't interfere. And it does not matter if you brand our leaders as criminals."
Kenyatta has said the indictment will not affect his ability to do his job and has urged the international community to respect the will of Kenyans.
British Prime Minister David Cameron has written to Kenyatta to congratulate him and all those elected last month, a Downing Street spokesman said Saturday.
Cameron "urged the Kenyan people to be proud of the strong signal they have sent to the world about their determination to exercise their democratic right peacefully," the spokesman said.
"He encouraged all Kenyans to continue this spirit of peace and accept the decision of the Court as final."
Cameron also welcomed Kenyatta's promise that his government would "work with all Kenyans in a spirit of inclusivity and reconciliation," while also meeting its "international legal obligations."
CNN's Nima Elbagir reported from Nairobi. Faith Karimi wrote and reported in Atlanta, while Laura Smith-Spark wrote in London. Zarifmo Aslamshoyeva and Lillian Leposo contributed to this report.
™ & © 2013 Cable News Network, Inc., a Time Warner Company. All rights reserved.