Nervous Kenyans are stockpiling food and water on the eve of an election that many fear could descend into violence. Opposition leader Raila Odinga has said President Uhuru Kenyatta can only win if his ruling Jubilee party rigs the vote. Around 150,000 security personnel including park rangers have been called up to maintain order across the country, including preventing demonstrations in hotspots immediately before or after the polls.

Pollsters say the 2017 race is too close to call, and the murder of a top election official and Odinga's repeated accusations of rigging have raised fears that political protests could once again degenerate into ethnic violence. One must win more than 50 percent of the vote to avoid a runoff election.

Raila Odinga is the son of Jaramogi Odinga Odinga, the country's first vice president. After losing the past two elections, this may be the last chance for the 72-year-old to claim the seat that eluded his father. Odinga says he wants to restore a strong government, stamp out corruption and improve the lives of the poorest Kenyans.

Kenya elections
Kenyan opposition leader Raila Odinga, the presidential candidate of the National Super Alliance (NASA) coalition, attends a press conference in Nairobi Baz Ratner/Reuters

Kenyatta is the son of Jomo Kenyatta, Kenya's first president. 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 percent of the vote, triggering an unsuccessful legal challenge by Odinga.

Kenya elections
Kenya's President Uhuru Kenyatta waves to supporters during a Jubilee Party campaign rally in Nakuru Baz Ratner/Reuters

In 2007, Odinga's call for street protests after problems with the vote count triggered a widespread campaign of ethnic violence in which 1,200 people were killed and 600,000 displaced. The violence also hammered East Africa's biggest economy as regional trade ground to a halt and tourists, the biggest source of foreign exchange, cancelled holidays.

Much of the killing a decade ago was in Kisumu, a city of a million people, most of them from Odinga's Luo tribe, on the shores of Lake Victoria. "If he doesn't win, we are going to the streets and we'll demonstrate," 28-year-old potato seller Ruth Achieng, told Reuters during a visit to Kisumu.

Kenya elections
Kenya's Independent Electoral and Boundaries Commission officials check electoral material at a holding centre in Nairobi before it is distributed to polling stations Tony Karumba/AFP

Most political affiliations in Kenya are tied to ethnicity. Many voters see Kenyatta as the candidate of the Kikuyu people, the country's largest ethnic group, while Odinga represents the Luo. "Many middle-class Kenyans will, in an instant, go from speaking of globalisation and borderless innovation while sipping on their cafe macchiatos to offering blind support to a well-known thug who happens to be from their tribes," journalist Daniel Kalinaki wrote in a recent column for the Daily Monitor newspaper.

Kenya has 44 official tribes and election candidates usually form alliances with politicians from other ethnic groups to broaden their appeal. Odinga has built his National Super Alliance (NASA) with leaders from four groups, stitching together support from politicians from three other ethnic backgrounds.

Odinga dominates the west of the country and the coast, where residents feel neglected by the central government. Cosmopolitan urban centres are largely up for grabs, although Odinga's party controls the three big cities – Nairobi, Mombasa and his home town of Kisumu.

Opinion polls show Kenyatta and his deputy William Ruto command central Kenya and the Rift Valley, home to their Kikuyu and Kalenjin ethnic groups, which have supplied all of Kenya's presidents since independence. The current government of 22 ministers has five Kikuyu and five Kalenjin members.

Both candidates increased their efforts to win support across the nation after a new constitution passed in 2010. It stipulates that the presidential winner must get a quarter of the vote in at least 24 of the 47 counties, a measure designed to force powerful groups to build alliances with smaller tribes. The constitution also devolved power and money to the counties, giving smaller communities more control over resources and the chance of representation. This has eased some regional resentments. Still, ethnic voting patterns remain strong.

Two incidents in the last week have put the nation of nearly 50 million on edge. Chris Msando, the top election official in charge of electronic vote tallying, was found tortured and murdered a week ago, and on Friday (4 Aug) two foreign political advisers to Odinga were arrested and deported by plain-clothes police. Their laptops were also seized.