Nairobi, Kenya (CNN) -- Kenya swore in its youngest-ever president Tuesday before a massive crowd, including numerous heads of state and American civil rights activist Jesse Jackson.
Uhuru Kenyatta became the country's fourth president after a prolonged election dispute that ended up in the Kenyan Supreme Court.
Tens of thousands of people packed a Nairobi stadium Tuesday to watch the inauguration. Jackson, a former U.S. presidential candidate, attended the festivities as a private guest.
Kenyatta, the 51-year-old son of Kenya's founding leader, won the election with 50.07% of the vote.
His chief rival, Raila Odinga, won 43.31% of the vote. Odinga challenged the outcome in court, saying it was flawed and marred by technical problems.
After the court upheld Kenyatta's election, Odinga offered the president-elect his congratulations.
"The court has now spoken," Odinga said. "I wish the president-elect and his team well."
Kenyatta and Odinga are the sons of the nation's first president and vice president, respectively -- stirring memories of a political dynasty that dates back 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.
A new opportunity for Kenya
Despite controversy over the recent election results, the mutual acceptance by the two sons could help restore the nation's image as a bastion of stability after disputed election results in 2007 led to bloody chaos.
In that election, more than 1,200 people 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 in the streets with crude weapons, not in court.
But 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.
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.
CNN's Faith Karimi contributed to this report.