NAIROBI (Reuters) - Kenya's election commission dismissed claims on Wednesday by opposition leader Raila Odinga that its systems and website had been hacked to produce a "fictitious" lead for Odinga's long-time rival President Uhuru Kenyatta.
Angry protests erupted in opposition strongholds in the capital Nairobi and the western city of Kisumu as the counting of votes from Tuesday's election continued, but the election commission said the election had been free and fair.
Police shot dead at least three people and protesters killed a fourth, witnesses said. Although the violence remained largely contained, Kenyans were nervously hoping to avoid a repetition of the ethnic killings that followed a disputed 2007 presidential poll, when some 1,200 people died.
As of 1900 GMT, provisional results from the election commission website put Kenyatta in front with 54.3 percent of votes counted to 44.8 percent for Odinga - a margin of 1.4 million ballots with 97 percent of polling stations reported.
Earlier Odinga published his own party's assessment of the count on Twitter, saying he had 8.1 million votes against 7.2 million for Kenyatta. He provided no supporting documentation.
"Our election management system is secure. There was no external interference to the system at any point before, during, and after voting," election commission head Ezra Chiloba told a news conference.
"The (hacking) claims being made could not be substantiated from our end," he said following an investigation.
Odinga had said hackers could have used the identity of a top election official, who was tortured and murdered days before the vote. His statements raised concerns of unrest over the results in Kenya, which has East Africa's biggest economy and is a regional hub.
Odinga posted 50 pages of computer logs online to support his hacking claims, but they were "inconclusive", according to Matt Bernhard, who studies computer security in election systems at the University of Michigan.
Some time stamps appeared out of order and it was hard to evaluate the veracity of screenshots without access to a server, he said.
Odinga urged his supporters to remain calm but added: "I don't control the people". His deputy Kalonzo Musyoka said the opposition might call for unspecified "action" later.
In Nairobi police killed one demonstrator, and in Kisumu, an opposition stronghold, they fired teargas to scatter a group of 100 protesters. Unarmed men marched through the streets waving sticks and chanting "No Raila, no peace".
In coastal Tana River county, a gang wielding machetes attacked a tallying centre, killing one man and injuring another, said a community elder who witnessed the attack. Police shot dead two attackers.
Foreign observer missions declined to comment on the hacking allegations but urged all parties to stay calm.
Kenyatta, a 55-year-old businessman seeking a second five-year term, has held a steady lead of around 10 percent since the start of counting after Tuesday's peaceful vote, the culmination of a hard-fought contest between the heads of Kenya's two political dynasties.
Odinga, 72, a former political prisoner and self-described leftist, described the reported hack as an attack on Kenya's democracy and published 50 pages of computer logs on his Facebook page to support his claims.
Despite its multi-million dollar electronic voting system, the crucial evidence on voting comes from the paper forms signed at each of the country's 41,000 polling stations.
Results in each polling station are recorded on a form - known as 34A - that observers from each party must sign. These are then scanned and sent to the election board for posting online, a measure designed to combat rigging.
The commission said it was working flat out to post all 41,000 forms online.
The Kenya Human Rights Commission, a well-known non-governmental organisation, said it had discovered some discrepancies between provisional results on the election commission website and the paper forms.
Of 112 polling stations sampled by Reuters from across the country, two thirds had a match between the electronic and paper results. The rest either had no online scan of the 34A form, or the photographs were illegible or of something else.
There was one polling place that had a discrepancy of a single vote - a possible typo - and one with an unusually large number of rejected votes.
Odinga ran in Kenya's last two elections and lost, blaming vote rigging following irregularities on both occasions.
In 2007, tallying was halted and the incumbent president declared the winner, triggering an outcry from Odinga's camp and waves of ethnic violence that led to International Criminal Court charges against Kenyatta and his now-deputy, William Ruto.
The cases against them collapsed as witnesses died or disappeared.
In 2013, Odinga took his concerns to court, quelling potential clashes. The court later confirmed the result.
Kenya's shilling firmed and bond prices rose on early results, before retreating in the wake of the claims by Odinga, who is seen as less pro-business than Kenyatta.
"Kenyatta's provisional win will soothe those investors who feared a leftist shift in economic policy," said Hasnain Malik, global head of equities research at Exotix Capital.
"The most important issues are ahead of us: Does Odinga concede peacefully? His initial rhetoric suggests there is a risk he does not."
Kenya's B+ credit rating and stable outlook won't be affected by its election as long as there is no repeat of the 2007 violence, the S&P Global agency said.
Additional reporting by Maggie Fick in Kisumu, Joseph Akwiri in Mombasa, Noor Ali in Isiolo and Katharine Houreld, George Obultusa, Duncan Miriri and John Ndiso in Nairobi, and Marc Jones in London; Writing by Katharine Houreld and Ed Cropley; Editing by Matthew Mpoke Bigg and Gareth Jones