By Katharine Houreld
NAIROBI (Reuters) - Kenya's president took an early lead in Tuesday's national elections, preliminary results showed, the culmination of a hard-fought contest between the East African nation's two foremost political dynasties.
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 2015 GMT, after 40 percent 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.
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.
ODINGA'S LAST CRACK
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 crack at 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.
"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 (20 miles) north of the capital.
Hundreds of people had waited in line since 2 a.m., 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.
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.
"Everyone is coming out early and in big numbers because we need change so badly," said Anne-Marie Omondi, a 28-year-old Odinga supporter in Kisumu, an Odinga stronghold in western Kenya swept up in the 2007 unrest.
Kenyatta's strongholds are in central Kenya and the Rift Valley. Urban centers 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 U.S.-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 fueled wild online conspiracy theories and "fake news" items consumed voraciously by Kenya's tech-savvy population.
For a graphic on Kenya's presidential election, click: http://fingfx.thomsonreuters.com/gfx/rngs/KENYA-ELECTION/010050990M2/index.html
(Additional reporting by Maggie Fick in Kisumu, George Obulutsa and Duncan Miriri in Nairobi, Rajiv Golla in Gatundu and Joseph Akwiri in Mombasa; Writing by Ed Cropley; Editing by Alison Williams and Gareth Jones)