Violent protests erupted in Kenya after opposition leader Raila Odinga alleged fraud in the election. With results from almost all of the polling stations counted, President Uhuru Kenyatta was shown with a wide lead. Odinga claimed hackers used the identity of a murdered official to infiltrate the database of the country's election commission and manipulate results.

Soon after Odinga spoke on television, angry protesters in slums of Nairobi and the opposition stronghold of Kisumu in the southwest burned tyres, set up roadblocks and clashed with police. Dozens of residents gathered along a main road in Mathare and clashed with police who chased them back into the densely populated settlement that was a flashpoint in the 2007 election violence where around 1,200 people died.

Police said at least three people were killed as some slums in the capital, Nairobi, and other opposition strongholds erupted. Witnesses report that a man in Mathare slum was shot in the head by police. Nairobi police chief Japheth Koome said police had shot looters taking advantage of the protests.

Police killed another person when they opened fire on protesters in another opposition stronghold in Kisii county, according to Leonard Katana, a regional police commander. The violence stirred memories of the unrest following the 2007 vote in which more than 1,000 people were killed. Odinga lost that election; he also lost the 2013 vote to Kenyatta and took allegations of vote-tampering to the Supreme Court, which rejected his case.

Kenya's interior minister, Fred Matiangi, warned against the use of social media to stoke tensions. Officials have said it was unlikely they would shut down the internet but said they might shut down some social media if necessary to calm hate speech and incitement.

Speaking at a news conference, Odinga urged his supporters to remain calm but added: "I don't control the people". His running mate, Kalonzo Musyoka, also called for restraint as the fraud allegations are investigated. "There may come a time we may have to call you to action," Musyoka said. "But for now it is important we be strategic as we delve deep into this matter."

Odinga, a former prime minister, blamed Kenyatta's Jubilee Party for the alleged hacking of the election database. "The fraud Jubilee has perpetuated on Kenyans surpasses any level of voter theft in our country's history. This time we caught them," he tweeted. He also posted online what he said were computer logs proving his allegation.

Odinga claimed that hackers used the identity of Christopher Msando, an election official in charge of managing information technology systems. On 31 July officials announced that Msando had been tortured and killed, alarming Kenyans who feared a recurrence of political violence that has been fuelled by ethnic divisions. An entry dated 8 August in the purported computer logs that Odinga posted on Facebook reads: "Login failed for user 'msando'. Reason: The password of the account must be changed." Rafael Tuju, a top official in Kenyatta's party, said the opposition's claims were unfounded.

Kenya's election commission said it will investigate Odinga's allegations. "For now, I cannot say whether or not the system has been hacked," said Wafula Chebukati, the commission chairman.

Kenyatta was leading with 54.35 percent and Odinga had 44.77 percent after votes at more than 39,320 of the 40,883 polling stations were counted, according to the election commission.

Police in the western Kenyan city of Kisumu used tear gas, live rounds and water cannon to disperse stone-throwing supporters of Odinga who had blocked roads into city slums with bonfires and boulders. The western port city on Lake Victoria has been a flashpoint in past elections. The city is home to a million people, most of them from Odinga's Luo tribe, who feel neglected by a central government led by Kenyatta.