ARTICLE AD BOX
By Evelyne Musambi
BBC News, Nairobi
Kenya's Deputy President William Ruto has defied the odds by winning the fiercely contested presidential election in East Africa's powerhouse.
His victory was narrow, stunning, and highly controversial as four of the seven members of the electoral commission rejected the result amid claims of rigging.
There were chaotic scenes inside the main tallying centre. Scuffles broke out on the podium as the head of the commission, Wafula Chebukati, was seemingly about to announce the results.
Mr Chebukati later returned to declare Mr Ruto the winner, and insisted that the election was free and fair.
The official results show that Mr Ruto gained ground in the strongholds of Raila Odinga, his main opponent. He also won by a landslide in Mount Kenya - the political heartland of Mr Odinga's running-mate Martha Karua and the outgoing President Uhuru Kenyatta.
This helped swing the election in Mr Ruto's favour.
He was the underdog or, as he preferred to call himself, the "hustler", fighting what he saw as an attempt by two of Kenya's biggest political dynasties - the Odingas and Kenyattas - to hang on to power. This narrative struck a chord with many young Kenyans.
The 55 year old trailed in opinion polls, and faced a formidable opponent - Mr Odinga - who, in an extraordinary development, was backed by his long-time rival, President Kenyatta.
The president will now have to swallow his pride and hand over the reins of power to his deputy - a man he labelled during the campaign as "untrustworthy".
All this is conditional on the result being genuine - and not rigged as Mr Odinga's supporters allege.
Their position has been bolstered by the majority of election commissioners saying they cannot take "ownership" of the result, but Mr Chebukati was adamant that it reflected the will of Kenyans.
"I stand before you despite intimidation and harassment. I have done my duty according to the laws of the land," Mr Chebukati said.
Mr Ruto was magnanimous in his victory speech, saying he would work with "all leaders" and would strive to ensure the nation was "united and prosperous".
Mr Odinga has not yet spoken, but he stayed away from the official announcement of the result. It is not yet clear whether he will challenge the result in court, as he has done on previous occasions.
He has lost four previous elections. This was seen as his best chance of winning as Mr Kenyatta campaigned heavily for him, urging voters not to cast their ballots for Mr Ruto.
Mr Kenyatta conceded during the campaign that he had broken a pact to back Mr Ruto in this election. He justified it by comparing his deputy to a co-driver who threw things out of a vehicle while the driver was busy steering it.
As far as Mr Ruto is concerned, Mr Kenyatta campaigned for Mr Odinga because he wanted a "puppet president".
Aged 77, it is unclear whether Mr Odinga will run for the presidency for a sixth time in the next election in 2027.
Mr Ruto, one of the country's biggest maize farmers, has won at his first stab at the presidency - and will be Kenya's second-youngest president after President Kenyatta won in 2013 aged 50.
He is a powerful orator - becoming involved in politics two decades ago in the youth wing of the then-ruling party - and drew huge crowds during the campaign.
He has managed to eat into Mr Odinga's strongholds in the coastal, western and north-eastern parts of the country.
His victory is all the more remarkable as he won by a landslide in Mr Kenyatta's backyard of Mount Kenya, the heartland of the Kikuyu people who are the largest voting bloc in Kenya.
Mr Ruto's party also took a huge majority of seats in the region in elections for parliament, the senate and the governor's post, ousting Mr Kenyatta's Jubilee party.
In the presidential vote, he won in most constituencies that make up the Mount Kenya region and even trounced Mr Odinga in the constituencies of both his running mate, Martha Karua, and Mr Kenyatta.
Supporters of Mr Ruto in Mount Kenya who spoke to the BBC before the elections said they felt the need to honour the 2013 pact to pay back his backing for their son Mr Kenyatta.
It is a humiliating setback for Mr Kenyatta who now leaves office with his reputation tarnished among his own Kikuyu people.
His own cousin, who chairs an association of elders, said they would back Mr Ruto.
The win will be lauded by many young people, who formed the majority of his support-base.
Mr Ruto coined the phrase "Hustler Nation" to refer to the young people struggling to make ends meet, and promised a "bottom-up approach" to the economy, saying it will benefit the poor.
He will now have to deliver on his promise.
It will be a difficult task as the official rate of unemployment among those aged between 18 and 34 years is nearly 40%, and the economy is not creating enough jobs to absorb the 800,000 young people joining the workforce every year.