NAIROBI, Kenya (CNN) -

Uhuru Kenyatta, the son of Kenya's founding leader, narrowly won the presidential poll despite facing charges of crimes against humanity over election violence five years ago.

Kenyatta clinched 50.07% of the vote, the election commission announced Saturday, barely breaking past the halfway mark.

His main rival, Prime Minister Raila Odinga, got 43.31% of the vote, and said he will challenge the outcome in court.

The constitution requires a 50% plus one vote for an outright win.

His victory puts the West in a quandary. Kenyatta is facing trial at the International Criminal Court over post-election violence that plunged the nation into chaos in 2007.

Shortly after election officials announced the results, he thanked citizens for bestowing him the leadership role and vowed to work for everyone.

"We celebrate the triumph of democracy; the triumph of peace; the triumph of nationhood," Kenyatta said. "Despite the misgivings of many in the world, we demonstrated a level of political maturity that surpassed expectations."

Winning parties should remain "modest in victory," he said, acknowledging that nearly half the nation did not vote for him.

Jubilant supporters took to the streets, speeding down crowded streets, honking and chanting his name.

"This is a new dawn, our leader has been elected," said John Kamau, a Nakuru resident.

'It is frustrating'

For some of Odinga's strongholds, the mood was tense but calm.

"Our man has tried to be president three times, it is frustrating," said James Ouma, who lives in the capital of Nairobi. "We will accept it. What can we do? Life must go on."

Odinga said the election outcome is flawed.

"We are confident that the court will restore the faith of Kenyans in the democratic role," he said.

Despite the looming challenge, Kenyatta struck a conciliatory note after the close election, applauding Odinga for a "spirited campaign,"

"I know that all the candidates have made tremendous personal sacrifices .. and I welcome them to join us in moving our nation forward," he said.

A vital ally

The vote's significance extends far beyond Kenyan 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.

Most importantly -- at least to the West -- Kenya is 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.

Complicated relations

Kenyatta's victory raised the prospect of complicated diplomatic ties with the West.

The International Criminal Court 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.