The violence in east Africa's richest economy, seen as a bastion of stability, traumatised the nation and stunned observers.
Nairobi: Kenya's election campaign enters a tense final week Tuesday, with a tight race between incumbent Uhuru Kenyatta and his rival Raila Odinga leading to intensified personal attacks and rigging accusations.
The longtime political foes face off at the polls for a second consecutive time on August 8, and Kenyans are on edge after an acrimonious campaign marked by the opposition's deep distrust of the electoral commission.
The vote comes 10 years after Odinga claimed an election was stolen from him and the country plunged into two months of politically-motivated ethnic clashes, which along with a police crackdown on protests left more than 1,100 dead and 600,000 displaced.
The violence in east Africa's richest economy, seen as a bastion of stability, traumatised the nation and stunned observers. Voting in Kenya largely takes place along communal lines, and both Kenyatta and Odinga are heading formidable alliances of different ethnic blocs with closely matched numbers, meaning turnout will be crucial to either side's success.
While campaigning has largely been peaceful, the run up to the vote has been marred by the murder of a top election official charged with overseeing the electronic voting and tallying system.
Additionally months of attacks by pastoralists invading private land in the Rift Valley has been blamed on politicians seeking to displace populations ahead of the vote.
In the same region a hotspot after the disputed 2007 vote hate speech flyers have been circulating and some have already begun fleeing their homes in anticipation of trouble.
Elsewhere in the country Kenyans have moved from cities to their hometowns, both to vote and as a measure of security. Many foreign companies have temporarily closed down, advising expat staff to head out of the country.
"The anxiety that has engulfed the country in the countdown to the elections is unhealthy," read a recent editorial in the Daily Nation newspaper.
"Businesses are holding back, tourism is slackening worse some foreign embassies have sent out travel advisories to their nationals against visiting Kenya."
Somalia's Al-Qaeda-linked Shabaab has also stepped up attacks in northeastern Kenya ahead of the election.
An unprecedented 180,000 members of the security forces will fan out across the country to secure the poll in which Kenyans will elect a new president, governors, lawmakers, senators, county officials and women's representatives.
Constitutional reforms after the 2007 violence decentralised power to the country's 47 counties in the 2013 vote. While this removes the winner-takes-all aspect from the presidential race, it has raised the stakes and potential for violence at the local level.
However all eyes remain on the battle between Kenyatta and Odinga, whose fathers Jomo Kenyatta and Jaramogi Oginga Odinga were rivals in the independence era and the decades that followed.
Odinga, 72, who is flag bearer for the National Super Alliance (NASA) of five major opposition parties, is running for office for the fourth time. He claims that elections in 2007 and 2013 were stolen from him and that Kenyatta is planning to rig this year's election.
In 2013 a biometric system of voting and tallying results partly collapsed, stoking Odinga's suspicions the poll was rigged in favour of Kenyatta, who won by just 800,000 votes.
However he took his complaints to the courts instead of the streets, and while there were some riots and looting, the election largely went off peacefully.
In the run up to this year's election Odinga has disputed the company chosen to print presidential ballots, the process in which results will be announced and the presence of dead people on the voters register.
"We are prepared to protect our vote and avoid electoral theft," Odinga told a recent rally. During a frenzied final push of campaigning around the country, Kenyatta has accused Odinga of trying to stoke violence, while having "no credible agenda".
Kenyatta, 55, is seeking re-election after a first term in which he was credited with a massive infrastructure drive and overseeing steady economic growth of more than five percent.
However his administration has been dogged by several graft scandals, with the country dropping six points in Transparency International's corruption index in 2016.
According to opinion polls, voters' main concern is soaring food prices due to inflation and drought. Kenyatta's campaign has also been marred by anger over a shortage of the country's staple, maize meal.
More than 19 million Kenyans are registered to vote in the election. To avoid a second round, the winning candidate must score more than 50 percent of the overall vote, and 25 percent of the vote in at least 24 counties.