The final days of campaigning have been marred by the murder and torture of a top election official.

Kenyans head to the polls Tuesday to vote in a knife-edge contest between incumbent Uhuru Kenyatta and his rival Raila Odinga which has heightened claims of vote rigging and fears of violence.

The final days of campaigning have been marred by the murder and torture of a top election official, opposition claims one of its vote tallying centres was raided by police and a feverish atmosphere of conspiracy and suspicion.

The August 8 election is seen as a crucial test of Kenya's progress since a disputed poll a decade ago led to 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.

Kenyans will cast ballots in six different elections, but all eyes are on what is set to be the last showdown of a dynastic rivalry between the Kenyatta and Odinga families that has lasted more than half a century.

The men belong to two of the country's main ethnic groups, Kenyatta from the Kikuyu, the largest, and Odinga the Luo. Both have secured formidable alliances with other influential communities in a country where voting takes place largely along tribal lines.

Polls are so tight the vote is seen as too close to call, and turnout will be crucial to either side's success in the 48-million-strong east African nation.

The 72-year-old Odinga at the head of the National Super Alliance (NASA) coalition, is taking his fourth — and what many suspect will be his last — stab at the presidency. He claims both elections in 2007 and 2013 were stolen from him and is adamant Kenyatta's Jubilee party is trying to do the same this time around.

Mounting opposition distrust of the electoral commission has seen Odinga crying foul and urging his supporters to “protect their vote”.

Both candidates are so certain of victory, that Nic Cheeseman, professor of African politics at Birmingham University, warns they may have "talked themselves into a corner" in which defeat is not an option.

"It seems almost inevitable that whoever loses will question the result. The question is not whether or not they will accept the result but what they will do when they don't accept it," he told AFP.

Murder, deportation

Observers agree that the most critical aspect to the election's success is whether a biometric system of voter identification and tallying works on the day.

This system was introduced in a bid to counter rigging and boost confidence in the process after the marred 2007 election. However in 2013 electronic glitches forced polling officials to resort to manual counting.

Odinga claimed there was rigging, however he took his complaints to the courts instead of the streets and despite a few riots after he lost his case, the process ended peacefully.

The tension around the electronic system reached breaking point last weekend after the poll commission's top IT manager Chris Msando was found strangled and tortured in a forest on the outskirts of Nairobi.

The Independent Electoral and Boundaries Commission (IEBC) said its system had not been compromised, and a dry run of the tallying process went off without a hitch this week.

Then late Friday the opposition claimed its main parallel tallying centre — which had been a point of dispute with the ruling party — was raided and their equipment stolen.

The same evening, an American and a Canadian working with NASA on their poll strategy were detained before being deported the next day.

Cheeseman said both these events looked "like an attempt by a political faction to prevent the opposition from verifying and checking results. It is highly suggestive they intend some form of manipulation."

Massive security

Pre-election jitters have seen foreigners and Kenyans leaving the country or main cities and stocking up on provisions in case of trouble.

Up to 180,000 security forces will secure the poll in which Kenyans will also elect governors, lawmakers, senators, county officials and women's representatives in local races also rife with tension.

The two presidential candidates' fathers Jomo Kenyatta and Jaramogi Odinga were allies in the struggle for independence, but later became bitter rivals, setting the stage for decades of political rancour.

Kenyatta, 55, is seeking re-election after a first term in which he and his Jubilee Party were credited with a massive infrastructure drive and overseeing steady economic growth.

However polls show voters concerned about soaring food prices and massive corruption scandals.

More than 19 million Kenyans are registered to vote at over 40,000 polling stations. Voting will start at 6am local time (0300 GMT) and close at 5pm (1400 GMT).