William Ruto has been sworn in as Kenya's fifth president, a week after the Supreme Court rejected a challenge by his defeated opponent in a close-fought election that he won by portraying himself as an underdog "hustler" battling the elite.
Deputy president for the last decade, Ruto must now confront an economic crisis in east Africa's wealthiest and most stable country, where food and fuel prices are surging, unemployment is high and public debt rising.
"A village boy has become the president of Kenya," Ruto said at the ceremony, as the crowd erupted in cheers.
As severe drought exacerbates a major food crisis in east Africa, he promised to make 40 million half-price bags of fertiliser available next week.
The 55-year-old won last month's election despite a public repudiation by his boss, outgoing president Uhuru Kenyatta, who said Ruto was "not fit for office".
Both sides hurled accusations of corruption during a deeply personal, acrimonious campaign.
Kenyatta's preferred successor, veteran opposition leader Raila Odinga, had accused Ruto of cheating his way to victory.
But Odinga accepted the Supreme Court ruling upholding the result, laying to rest fears of political violence like that seen after disputed elections in 2007 and 2017.
"There should be no revenge," Bishop Mark Kariuki thundered at Tuesday's ceremony, wearing a deep purple stole embroidered "PEACE".
Odinga did not attend but Kenyatta shook hands with Ruto before he was sworn in and issued a congratulatory message the night before.
In his speech, Ruto asked Kenyatta to continue leading regional peace efforts in neighbouring Ethiopia and African Great Lakes countries.
The peaceful transfer of authority will burnish Kenya's democratic credentials in a region where some leaders have held power for decades.
Ugandan President Yoweri Museveni, in office for 36 years, and Ismail Omar Guelleh, who has been Djiboutian president for 23 years, were among many African leaders attending.
Ruto greeted each head of state by name before laying out his next steps in his speech.
He pledged to immediately swear in six judges nominated to the Court of Appeal three years ago and make the police financially independent from the president's office, and to stick to Kenya's plans to produce 100 per cent clean energy by 2030.
Ruto supporters wearing his party's colours of yellow and green had packed Nairobi's 60,000-seat Kasarani Sports Centre by 5am.
The National Police Service had tweeted that the stadium was full by 5am and asked citizens to stay home but crowds continued to try to force their way inside.
The St John's Ambulance Service said it had taken several injured people to hospital.
Ruto, a former roadside chicken seller who is now a wealthy businessman, campaigned as challenger to the powerful families that have dominated Kenyan politics since independence in 1963.
Odinga and Kenyatta are the sons of the country's first vice president and president respectively.
That message - represented by his party symbol of a wheelbarrow - resonated with chronically underemployed youths and families squeezed by poverty and rampant corruption, which Kenyatta publicly acknowledged he was unable to rein in.