President Uhuru Kenyatta was declared winner Friday of Kenya's hard-fought presidential election, but opposition candidate Raila Odinga alleged the voting was rigged.
In announcing the results of Tuesday's contest, the election commission said Kenyatta won a second term with 54 percent in balloting it called "credible, fair and peaceful."
Hundreds of riot police were in the streets of the capital, Nairobi, amid fears of further protests by opposition supporters, who called the vote a "charade" and said challenging the outcome in court wasn't an option.
Kenyatta, the 55-year-old son of Kenya's first president after independence from Britain, appealed for calm and unity after the bitter campaign.
"Kenya belongs to all of us," he said. "Let us shun violence and let us refuse to be used for short-term political gain."
He said he was extending a "hand of friendship" to "our older brother," Odinga.
"We need and must continue to work together for the welfare of our people and in order to keep this country united," said Kenyatta, who also defeated Odinga in 2013.
"We reach out to you. We reach out to your supporters."
The election was a test of the stability of the East African economic power as many recalled the postelection bloodshed a decade ago that left more than 1,000 dead.
"We have seen the results of political violence and I am certain there is no single Kenyan who would wish to go back to those days," Kenyatta said.
Kenya had been relatively calm since the election but had braced for possible violence Friday night with police in the central business district.
Although celebrations by backers of Kenyatta were reported in several cities across Kenya, gunshots and screams were heard in at least two areas populated by Odinga supporters, according to police and a witness.
The gunfire rang out in the Nairobi slum of Kibera and in the southwestern city of Kisumu, the witnesses said. Youths also were reported to be throwing stones at cars in Kibera.
"There are gunshots all over; we don't know how it will end but we are praying for peace," said Kisumu resident Lucas Odhiambo, adding that people were bellowing through "vuvuzela" noisemakers when the results were announced "and police moved in."
Earlier in the day, opposition supporters burned tires and blocked roads in several areas.
The election commission rejected claims by Odinga, a former prime minister, that its database was hacked and results manipulated against him.
The long wait for election results increased tensions in the nation of 45 million people, though the commission by law had until Aug. 15 to announce them. At least three people were killed in clashes between police and opposition supporters this week.
Odinga alleged that hackers infiltrated the election commission's computer system in favor of his opponent. He claimed the hackers used the identity of Christopher Msando, an election official in charge of managing information technology systems. Officials had announced on July 31 that Msando had been tortured and killed.
In addition, the American CEO of an election data company working for Odinga was deported last weekend.
The election commission said there was a hacking attempt but it failed, and that Odinga's camp had no right to declare him as the winner.
Earlier Friday, the opposition said it had asked for access to the commission's servers to confirm whether the alleged hacking took place. If granted, it said it would accept the results, even if they showed that Kenyatta won.
Kenyatta has not commented on Odinga's allegations.
International election observers have said they saw no signs of interference with the vote. Election officials spent recent days confirming provisional results with checks of documents from polling stations nationwide.
U.S. Ambassador Robert F. Godec said any disputes should be dealt with through legal channels. "No Kenyan should die because of an election," he said.
This may have been the last chance at the presidency for the 72-year-old Odinga after three unsuccessful attempts.
Odinga lost the 2007 election that was followed by the violence that was fueled by ethnic tensions. He also lost the 2013 vote to Kenyatta and took allegations of vote-tampering to the Supreme Court, which rejected his case.