Uhuru Kenyatta was sworn in as Kenya's fourth president on Tuesday to thunderous cheers from tens of thousands of supporters, despite facing trial on charges of crimes against humanity.
"I do swear that I will be faithful and bear true allegiance to the Republic of Kenya," said Kenyatta, the son of the country's first president, clutching a bible as he took the oath of office.
Wearing a dark suit and red tie, he also pledged to "protect and uphold, the sovereignty, integrity and dignity of the people of Kenya".
Officials had to appeal for quiet as 60,000 people packed into Kenya's national football stadium chanted Kenyatta's name and roared in support as they danced.
William Ruto, who like Kenyatta faces trial at the International Criminal Court (ICC) for crimes against humanity related to post-election violence five years ago, took the oath of office as vice-president.
"I will always truly and diligently serve the people and the Republic of Kenya in the office of the deputy president," Ruto said.
"I will do justice to all without fear, favour, affection and ill will," he added.
Kenyatta, one of Africa's richest men, won the March 4 polls by more than 800,000 votes ahead of his nearest rival, outgoing Prime Minister Raila Odinga.
The 51-year-old is Kenya's youngest president.
Security was heavy as Kenyatta loyalists, dressed in the red colours of the winning Jubilee Coalition party, waved and military bands played tunes to welcome the new leader and bid farewell to outgoing President Mwai Kibaki, 81, retiring after more than a decade in power.
Kibaki handed over Kenya's symbols of power -- a sword and the constitution -- to Kenyatta, with both smiling broadly and shaking hands. The handover was followed by a booming 21-gun salute.
Regional leaders and foreign diplomats watched as the full to capacity stadium danced and sang along to music and a military parade.
Among the heads of state attending the ceremony were Ethiopia's Hailemariam Desalegn, Somalia's Hassan Sheikh Mohamud, South Sudan's Salva Kiir, Tanzania's Jakaya Kikwete and Uganda's Yoweri Museveni.
Odinga, who failed in his court bid to overturn Kenyatta's victory, did not attend.
Western nations, many of which have a policy of only "essential contact" with ICC indictees, sent ambassadors to the ceremony.
Many supporters packed in buses arrived long before dawn from central Kenya and the Rift Valley, strong support bases of Kenyatta and Ruho.
"This is a great day," 23-year-old student Martin Munyua told AFP. "People thought Uhuru could not be president but we showed them that we believe in him. This is our day to celebrate."
"We have come to welcome our new sons to the State House," said 35-year old high school teacher Jairus Koech, who travelled all night from the Rift Valley town of Eldoret to attend the celebrations.
Odinga and civil society groups filed legal challenges alleging the March polls were marred by a series of irregularities that skewed the results.
However, Kenya's Supreme Court last month unanimously ruled the election had been fair and credible and Odinga said he would respect the ruling.
The polls were peaceful apart from isolated incidents, avoiding a repeat of the ethnic killings and widespread violence that followed the 2007 election, when more than 1,100 people were murdered and several hundred thousand forced to flee their homes.
Local media on Tuesday warned that Kenyatta faced a tough task in uniting the country.
"Fortunately the country remained peaceful during the elections, but unfortunately many still feel disenfranchised," The Star newspaper said in an editorial.
"A sense of national unity, patriotism, belonging and pride will only come about with a very deliberate programme to heal the septic ethnic wounds that so pollute our politics," the Daily Nation said.
"We hope that magnanimity in victory will be reciprocated by grace in defeat."
Both Kenyatta and Ruto, who are due to appear at the ICC later this year for their trial in The Hague, said they will cooperate fully with the court.
They deny the charges against them.
Kenya, as a signatory of the Rome Statute of the ICC, would be expected to act on any arrest warrant issued by the court should the pair fail to appear for trial.