Kampala - Kenyans are nervously watching results from the election between President Uhuru Kenyatta, who is ahead in the vote count as he seeks a second term, and Raila Odinga, who alleges that the electoral commission's database was hacked.
The East African high-tech and commercial hub of 44 million people is often described as one of the continent's most politically stable countries, but the recent torture and killing of the official in charge of the electronic voting system has many recalling the disputed 2007 election between the same candidates that left more than 1 000 people dead.
A look at the issues:
Kenyatta and Odinga are from storied political families. Kenyatta is the son of Jomo Kenyatta, Kenya's first president, and Odinga is the son of Jaramogi Odinga Odinga, the country's first vice president.
One must win more than 50% of the votes that were cast on Tuesday to avoid a runoff election.
After losing the past two elections, this could be the last chance for the 72-year-old Raila Odinga to claim the seat that eluded his father.
The 55-year-old Kenyatta wants to avoid becoming the first Kenyan president not to win re-election. He won in 2013 with 50.03% of the vote, triggering an unsuccessful legal challenge by Odinga.
Kenyatta at the time faced criminal charges at the International Criminal Court over his alleged role in the 2007 election violence.
Those charges were dropped due to lack of evidence, with the ICC prosecutor blaming unprecedented witness interference and bribery.
Most political organising in Kenya is tied to ethnicity. Many voters see Kenyatta as the candidate of the Kikuyu people, the country's largest ethnic group, and Odinga representing the Luo. The Luo have never produced a head of state.
The torture and killing in late July of Christopher Msando, the official in charge of Kenya's electronic voting system, fueled concerns that the balloting could be rigged.
The biometric system malfunctioned in the 2013 election, leading to opposition claims of vote-tampering.
Odinga on Wednesday claimed that hackers used Msando's identity to gain entry to the election commission's database in order to manipulate voting results.
He blamed Kenyatta's party, tweeting that "the fraud Jubilee has perpetuated on Kenyans surpasses any level of voter theft in our country's history. This time we caught them."
The head of the election commission says Odinga's claims will be investigated.
Threats of Violence
Protests began on Wednesday in parts of the capital, Nairobi, and in one of the country's largest cities, Kisumu, after Odinga's allegation of hacking.
Protesters in Kisumu, a stronghold of Odinga, said police were firing at them and using tear gas. And police said at least one person was killed when officers fired on protesters clashing with security forces in another opposition stronghold in Kisii County.
Kenyan officials have said it is unlikely they would shut down the internet, but they might shut down some social media if necessary to calm hate speech and incitement.
Interior Minister Fred Matiangi on Wednesday warned against abuse of social media to create tension and anxiety.
Another security concern has been the al-Shabaab extremist group, based in neighbouring Somalia, which already has threatened Kenya's elections with a series of deadly attacks in border areas.
That strains Kenya's security forces as they seek to keep the country calm.