Long lines of Kenyans queued from way before dawn to vote Monday in the first election since the violence-wracked polls five years ago, with a deadly police ambush hours before polling started marring the key ballot.
The tense elections are seen as a crucial test for Kenya, with leaders vowing to avoid a repeat of the bloody 2007-8 post-poll violence in which over 1,100 people were killed and observers repeatedly warning of the risk of renewed conflict.
Voters standing in snaking lines several hundreds of metres (yards) long -- and several people thick -- crowded peacefully outside polling stations to take part in one of the most complex elections Kenya has ever held.
People began lining up outside polling stations from as early as 4:00 am (0100 GMT) to cast their votes, two hours ahead of the official opening of the polls.
In middle-class areas of Nairobi, parked cars blocked the streets around polling stations, with progress slow in some centres due to delays due to malfunctioning electronic registration equipment.
Ahmed Issack Hassan, Independent Electoral and Boundaries Commission (IEBC) chairman, said he was "aware of the challenges faced in various parts of the country" and were addressing them, appealing for voters to "be patient".
Tensions were high on the coast including the port city of Mombasa with six policemen killed in two separate attacks, including an ambush by some 200 youths armed with guns and bows and arrows, hours before the opening of polling stations.
"Six policemen and six attackers were killed during the confrontation" in the port city of Mombasa, Kenyan police chief David Kimaiyo told reporters, adding that 400 officers were being sent to the coastal province to beef up security.
Kimaiyo said the attackers were suspected members of the Mombasa Republican Council (MRC), a group seeking the secession of the coastal region popular with tourists.
Police have blamed the MRC for a string of attacks last year, and the group had threatened to boycott the polls.
Despite the attack, voters packed the streets in the city.
"We are not worried, we are voting," said architect Said Said, waiting to cast a ballot at a primary school.
A remote-controlled bomb was also set off in the northeastern town of Mandera, a town on the restive border with war-torn Somalia, but resulted in no casualties, police said.
Neck-and-neck rivals for the presidency, Prime Minister Raila Odinga and his deputy Uhuru Kenyatta, have publicly vowed there will be no repeat of the bloodshed that followed the disputed 2007 polls.
Crimes against humanity trials later this year at The Hague-based International Criminal Court (ICC) for Kenyatta and running mate William Ruto have raised the stakes: should they win the vote, the president and vice-president could be absent on trial for years.
Both front runners have said they are confident of winning the absolute majority needed to avoid a second round run off vote.
Kenyans are casting six ballots, voting for a new president, parliamentarians, governors, senators, councillors and special women's representatives.
Some 14.3 million Kenyans are eligible to vote at the more than 30,000 polling stations across the country.
After hard-fought campaigns tensions are running high, with national newspapers all carrying the same front page message of "never again" in reference to the violence of 2007-8.
In Nairobi's shanty town Kibera, scene of some of the worst ethnic clashes during the 2007 elections -- and where a tired looking Odinga voted surrounded by a mob of journalists -- thousands waited to cast their ballots, with the start of voting delayed for almost an hour.
"We can win these elections in the first round...At the end of the day we will definitely be declared the winner," Odinga said after voting.
Kenyatta, voting in his hometown of Gatundu some 90 kilometres (55 miles) north of Nairobi, said he was "ready and prepared for whatever outcome" Kenyans chose.
More than 99,000 police have been deployed to ensure the vote is peaceful, and about 23,000 observers, including 2,600 international monitors, are watching the vote, officials say.
In the western town of Kisumu - the heartland of Odinga supporters who went on the rampage in 2007-2008 after he was controversially pipped to the top job by President Mwai Kibaki -- people blew whistles and sang as they waited to vote.
"We slept here last night because we want real change and we want our candidate -- Raila," said Susan Morell, 30. "We want real change but we want peace. We will accept the result as it comes out because we are sure of winning."
The 2007-2008 violence exposed widespread disenchantment with the political class, deep tribal divisions and shattered Kenya's image as a beacon of regional stability.
More checks are in place this time to limit vote rigging, while a new constitution devolves powers and has made the poll less of a winner-take-all race.