Elections in Kenya have often produced disputed results and set off deadly violence, with rivals accusing each other of fraud and vote-rigging.
Here is a look at past crises:
1992:
Daniel arap Moi is elected president in Kenya's first multi-party poll on December 29, 1992, benefiting from deep divisions among opposition figures.
Moi had been in power since 1978 when he took over after the death of Jomo Kenyatta, Kenya's first leader after independence from Britain.
The 1992 vote is marred by violence between Moi's Kalenjin tribe and the Kikuyu community to which Kenyatta and much of the Kenyan elite belong. Hundreds of people are killed.
2007-2008:
Outgoing president Mwai Kibaki is proclaimed winner for a second term on December 27, 2007 but his challenger Raila Odinga says the vote was rigged.
Clashes in the weeks that follow kill more than 1,100 people and force 600,000 from their homes in a country generally seen as a beacon of stability in Africa.
The Rift Valley is the epicenter of the violence, where members of the Kalenjin and Luo communities, who mainly back Odinga, clash with members of the Kikuyu tribe, to which Kibaki belongs.
On February 28, 2008, an internationally brokered power-sharing agreement is signed under which Kibaki keeps his job and Odinga becomes prime minister.
In 2010, the International Criminal Court (ICC) opens a probe into crimes against humanity over the 2007-2008 violence.
Two years later, its judges confirm charges against Uhuru Kenyatta, son of Jomo Kenyatta, and William Ruto, both of whom were members of opposing parties at the time, for their alleged role in the violence.
Kenyatta wins the 2013 election and a year later becomes the first sitting president to appear before the ICC.
But the cases against both Kenyatta and Ruto later collapse, with former ICC chief prosecutor Fatou Bensouda saying relentless victim and witness intimidation made a trial impossible.
2017:
Kenyatta beats longtime rival Odinga in the August 2017 presidential election, but Odinga rejects the results and claims hackers broke into the electoral commission database.
The announcement of Kenyatta's win sparks days of violent protests in Odinga strongholds.
Odinga takes his complaints to the Supreme Court and, in a shock announcement on September 1, judges declare the results of the poll "invalid, null and void" and order a re-run within 60 days. The annulment is a first for Africa.
Kenyatta is re-elected in October in a vote boycotted by the opposition and marked by low voter turnout.
Dozens of people die in protests that follow, mainly in clashes with police.
But the two men stun the country in 2018 by shaking hands and declaring a truce, leaving Deputy President Ruto out in the cold.
2022:
The presidential election on August 9, 2022 goes ahead smoothly.
After an anxious days-long wait, the Independent Electoral and Boundaries Commission (IEBC) announces on August 15 that Ruto has won with 50.49% of the vote, just ahead of Odinga on 48.85%.
Shortly before the announcement, the results are rejected by four out of seven IEBC commissioners. Violent protests break out in Odinga strongholds.
The next day Odinga, who is now making his fifth presidential bid, rejects the results, calling them a "travesty" and appeals for calm from his supporters, promising to pursue "all constitutional and legal options."
On August 22, he files an online petition to the Supreme Court challenging the result.
Judges have 14 days to issue a ruling. If they order an annulment, a new vote must be held within 60 days.