Kenya's incumbent president took an early lead in Tuesday's tightly contested national elections, according to preliminary results.
Shrouded in fears of violence, the vote pitted President Uhuru Kenyatta, a wealthy 55-year-old businessman and the son of Kenya's founding president, against Raila Odinga, 72, a former political prisoner and son of Kenya's first vice-president.
Kenyatta had 55 percent of the vote and Odinga 44 percent, the electoral commission website said at 21:00 GMT, after nearly two-thirds of polling stations had reported results.
Opinion polls released a week ago had put them neck-and-neck.
Campaigning was marked by fiery rhetoric but public speeches were largely free of the ethnic hatred that has marred previous contests as the two men faced off for a second time.
The electoral commission urged voters to wait calmly for results.
"During this critical phase, we urge all Kenyans to exercise restraint as we await official results from the polling stations and indeed as they start trickling in," it said.
Kenyans vote in tightly contested elections
Odinga comes from the Luo people in western Kenya, an area that has long felt neglected by the government and resentful of their perceived exclusion from political power.
Kenyatta is a Kikuyu, an ethnic group that has supplied three of Kenya's four presidents since independence from Britain in 1963.
Any glitches - innocent or otherwise - in the high-tech electronic voting and tallying system could be grounds for the loser to allege fraud, as Odinga did in 2007 and in 2013. Given his age, this is probably his last campaign for the top job.
A decade ago, vote tallying was abruptly stopped and the incumbent president declared the winner, triggering an outcry from Odinga's camp. The ethnic violence that followed killed 1,200 people and displaced 600,000.
International Criminal Court cases against Kenyatta and his now-deputy, William Ruto, for helping direct that violence collapsed as witnesses died or disappeared.
During the 2013 polls, Odinga again alleged fraud, but quelled unrest by taking his complaints to the courts.
This time, the government deployed more than 150,000 security personnel, including wildlife rangers, to protect 41,000 polling stations.
Thousands of people had returned to their ethnic heartlands before the vote, fearful of a repeat of the 2007 violence.
Voting was mostly smooth and turnout was high, the election commission said, despite some isolated incidents and delays. The police said there were no major problems.
In addition to a new president, Kenyans are electing lawmakers and local representatives, the result of a 2010 constitution that devolved power and money to the counties, reducing the "winner takes all" nature of the presidential race.
'The will of the people'
As he voted, Kenyatta said he would be willing to step down if he lost and called on Odinga to do the same.
"In the event that they lose, let us accept the will of the people. I am willing myself to accept the will of the people, so let them too," he said as he voted at the Mutomo Primary School in Gatundu, some 30 km north of the capital.
Kenya: Land disputes top agenda as election nears
Hundreds of people had waited in line since 2am (23:00 GMT), wrapped in jackets and blankets against the cold and drizzle.
The winner needs one vote more than 50 percent, and at least a quarter of the vote in 24 of Kenya's 47 counties.
There are more than 19 million registered voters in the nation of 48 million. Half are aged under 35.
First results began to come in on Tuesday night but a very close race means it might take three days before a winner emerges. Officially, election authorities have up to a week to declare the outcome.
Kenyatta's strongholds are in central Kenya and the Rift Valley. Urban centres are up for grabs, although Odinga controls Kenya's three big cities.
There is little to separate the two candidates in terms of economic policy although the US-educated Kenyatta is seen as more pro-business.
Throughout the day, Kenya's shilling held steady at around 103 to the dollar.
Odinga voted in Kibera, Kenya's biggest slum, but left without speaking to supporters. Later, his main ally Musalia Mudavadi said the opposition alliance was largely satisfied with the vote so far.
"We also wish to commend security agencies for the professionalism displayed so far," he said in a news conference.
The opposition, which has accused the government of trying to rig the poll, listed some problems, from agents being denied entry to polling stations, to names missing from the register and electronic voter identification devices failing.
The ruling Jubilee party also raised some issues but said it was largely satisfied.
The torture and murder last week of a top election official and the deportation of two foreign Odinga advisers have fuelled wild online conspiracy theories and "fake news" items consumed voraciously by Kenya's tech-savvy population.