Kenyans queued from long before dawn to vote on Monday in the first election since violence-wracked polls five years ago. A deadly police ambush marred the start of the ballot, which generally passed off peacefully.
The tense elections and the all-important reception of the results 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.
Uhruru Kenyatta, one of two top presidential candidates, cast his ballot in Mutumo polling station in his hometown of Gatundu in central Kenya.
He told Deutsche Welle's correspondent James Shimanyula he was happy with the turnout and hoped that Kenyans would come out in force to decide the outcome of the poll. He urged them to not to resort to violence .
"There is no need for antagonism. There is no need for violence. We are just telling Kenyans, be peaceful. Let us accept the result, because he or she who is elected on the day will be president," he said.
Opinion polls prior to the election said Kenyatta was running neck-and-neck in the race for the presidency with his rival Prime Minister Raila Odinga.
Kenyatta and his running mate William Ruto will go on trial later this year at the International Criminal Court in The Hague. They face charges of crimes against humanity in connection with the election violence five years ago.
Odinga cast his vote at the Old Kibera primary school in Langata constituency. He said that never before had Kenyans turned out to vote in such large numbers. "I am sure they want to make a very strong statement that they want change."
Observers had repeatedly warned of the risk of renewed conflict during this poll, but the conduct of voting itself passed off peacefully with no major reported violent incidents.
Voters standing for hours in snaking lines several hundred meters long and several people thick crowded peacefully outside polling stations to take part in one of the most complex elections Kenya has ever held.
Margaret Omondi is an election observer for the Coalition On Violence Against Women (COVAW) in Kisumu. She said the biometric voter registration machines were not working, "but people understood and were voting very well."
Kisumu is western Kenya is the heartland of Odinga supporters who went on the rampage in 2007-2008 after he was narrowly defeated in a disputed election by President Mwai Kibaki. On Monday people blew whistles and sang as they waited to vote.
Tensions were high on the coast, including in the port city of Mombasa where six policemen were 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.
Kenyan police chief David Kimaiyo said the Mombasa attackers were suspected members of the secessionist Mombasa Republican Council (MRC), and that 400 officers were sent to beef up security in the popular tourist region. The MRC has denied responsiblity for the attacks.
Despite the killings, voters packed the streets in the city.
The violence in the Mombasa area is separate to that caused by ethnic tensions which turned so deadly after the 2007 poll.
Kenyans began lining up from as early as 4:00 am East African Time to cast their votes, two hours ahead of the official opening of the polls.
Polls officially closed at 5.00 pm, although centers whose opening had been delayed, some for several hours, were to stay open to make up for the time missed.
Counting began immediately in stations that had closed.