Uhuru Kenyatta: Kenya's 'digital president'
Uhuru Kenyatta had barely begun his second term as president of Kenya when the Supreme Court invalidated his re-election.
At the time of the poll four years ago, candidate Kenyatta was facing an indictment by the International Criminal Court (ICC) on crimes against humanity charges.
Things have changed so drastically that Mr Kenyatta almost felt compelled to remind his supporters what had changed when his Jubilee party launched its manifesto in June.
"They told us that the world will shun us, but today no country in the world avoids meeting the president of the republic of Kenya."
The US and British governments had warned Kenyans that it would not be business as usual if Mr Kenyatta and his deputy William Ruto, who was also facing crimes against humanity charges at the ICC, were elected.
The Americans warned "choices have consequences" while the British cautioned that relations with Kenya would be scaled back to "minimal contact".
However, Kenya has been anything but a pariah state.
The East African nation is a key ally for western powers, especially against the al-Shabab Islamist militant group based in neighbouring Somalia, and it didn't take long for its leaders to decide that their strategic economic and security interests were more important than their stance on Mr Kenyatta's presidency.
During his presidency Kenya has hosted several international conferences and world leaders including former US President Barack Obama and Pope Francis came visiting.
In another triumph for Mr Kenyatta's diplomatic skills, he has mobilised many African leaders to put pressure on the ICC to the point of threatening to withdraw from the international court if it did not drop his and Mr Ruto's cases.
Both cases have now been dropped due to a lack of evidence, although the ICC says its prosecution witnesses were intimidated and says the cases could be resumed.
Who is Uhuru Kenyatta?
- Born in 1961, became Kenya's youngest president
- Brands himself as the "digital president"
- Accused of organising attacks on supporters of Raila Odinga after 2007 election
- Denies charges, denounces them as Western plot
- Son of the country's first president, Jomo Kenyatta
- Heir to one of the largest fortunes in Kenya, according to Forbes magazine
Four years ago Mr Kenyatta crafted a narrative that his main challenger, then and now, Raila Odinga was a project of foreign governments doing the bidding of former colonial powers via the ICC.
He called on Kenyans to reject Mr Odinga and assert their sovereignty. This message resonated with his base mostly from the Kikuyu ethnic group and Mr Ruto's Kalenjin community, leading to the pair's victory.
He also portrayed the older generation of politicians, such as Mr Odinga, now 72, as "analogue" and said they needed to hand over to the young, the "digital generation".
Mr Kenyatta matched his rhetoric with the glitz and colour.
He was fun, fresh and suave. He was down to earth, approachable and his ardent supporters said he was "demystifying the presidency".
However, while in power, critics have accused Mr Kenyatta of limiting freedom of expression.
His government has passed laws that have been seen as curtailing press freedom.
In 2016, a journalist from the Daily Nation, the country's biggest newspaper, was fired for writing an editorial critical of the president's economic record.
Gaddo, the country's top cartoonist, was also reportedly sacked for drawing a caricature that showed the president tethered to a ball on chain to depict his ICC troubles.
More on Kenya's elections:
On the economic front the big question is: Are Kenyans worse off today than they were in 2013?
Despite the economy growing on average of 5% a year since he took power and foreign investment increasing, many Kenyans still say they are not feeling the effect of the much touted growth.
An ongoing maize flour shortage and increases in the prices of basic foodstuff have put his government into fire-fighting mode. An importation of maize has failed to address the shortage.
His administration has also been accused of excessive borrowing, with an estimate that it has borrowed much more than the accumulative amount borrowed by all past governments since independence. The country's debt currently stands at $26bn (£20bn).
Mr Kenyatta, however, argues that investment in infrastructure like his signature project, the $3.2bn (£2.5bn) Chinese-funded Nairobi-Mombasa railway, will spur growth.
Mr Kenyatta promised to tackle corruption on coming to power but anti-corruption campaigner John Githongo said his administration was "the most corrupt in Kenya's history".
In its 2016 report on perceptions of corruption, Transparency International ranked Kenya at 145 out of 176 countries.
It blamed Kenya's ranking on the incompetence and ineffectiveness of anti-corruption agencies, saying that the failure to punish individuals implicated in graft had been a major stumbling block.
Mr Kenyatta said his anti-corruption efforts had been undermined by the courts, who were slowing prosecutions and the anti-corruption agency, which he said was "sluggish".
In 2015, Mr Kenyatta did act - he suspended and eventually removed five ministers and other high-ranking officials over corruption allegations. Another minister resigned after public pressure.
As the son of Kenya's founding father, Mr Kenyatta has the name, the wealth - and the burden that comes with his heritage. His father Jomo Kenyatta was the first president of Kenya.
When he was growing up, the young Kenyatta always shied away from politics, wanting to be seen as an ordinary person at ease with ordinary Kenyans.
As a child born to a rich and powerful family, he went to one of the best schools in Nairobi before attending Amherst College in the US where he studied political science and economics.
Mr Kenyatta does not have a natural flair for public speaking but has a powerful voice and can be persuasive when fighting his corner.
He has his mother to thank for ensuring that he mastered the local Kikuyu language, which helps him to connect with his countrymen in rural areas.
They love to call him "Kamwana", which means "young man" - and he made history in 2013 by being sworn in as Kenya's youngest president.
Former President Daniel Moi took him under his wing and named him as his successor in 2001, a decision that led to rebellion in the ruling party Kanu with top members joining other opposition parties to form the National Rainbow Coalition which won the 2002 election.
Mr Kenyatta's claim to be the digital president in 2013 was a metaphor for his youth but also a political strategy to reach out to Kenya's young population and embrace the country's ambition to become the centre of digital innovation on the continent.
In keeping with his image, he has kept his pre-election promise to deliver laptops to primary school children despite some major hiccups.
His administration has also launched e-centres - "one-stop shops" to access and pay for government services electronically in order to cut corruption and bureaucracy.
Kenyans can now file their taxes and apply for passports, drivers licence, ID cards and access other government services online, cutting hours spent queuing for these services.
His administration also set up an online portal to track government projects and another to report corruption directly to him.
His critics have said that these initiatives are for show and have not helped bring transparency to his government nor helped fight corruption.
Mr Kenyatta boasts very active Facebook and Twitter accounts and has not been shy to join in social media trends.
He once famously did a dab dance.
He is ranked by Forbes Magazine as the 26th richest person in Africa, with an estimated fortune of $500m (£320m).
He is also a media mogul - the Kenyatta family owns TV channel K24, The People newspaper and a number of radio stations.
The family also has vast interests in the country's tourism, banking, construction, dairy and insurance sectors.
They also own huge parcels of land in the Rift Valley, central and coastal regions of Kenya.
It is the land question that haunts Mr Kenyatta and the rest of his family wherever they go in Kenya.
In an interview with BBC's HardTalk programme in 2008, he was asked how much land his family owned.
He replied: "I don't need to answer that question because that's not the issue. Land reform is not about a person; land reform is about a nation. It's not that I won't tell you. It's that I don't need to tell you."
Land is the source of nearly all ethnic clashes that bedevil the Rift Valley. It is so divisive that during the last election the inspector general of police told political candidates not to make it a campaign issue. There have been similar calls in this election.
In 2013 candidate Kenyatta, faced with the ICC indictment, rallied his supporters to vote for him against what he called outsiders who he said were supporting his opponent.
This year, it was his record in government that became a key campaign issue.
And he may have to do more of it.