Kenya's incumbent President Uhuru Kenyatta was officially declared the winner Friday of a heated election that his rival claims to have won, setting off violent protests in some opposition strongholds.
Reports of rioting in several slum districts of the capital, Nairobi, and in parts of western Kenya stoked fears of a reprise of deadly ethnic fighting that followed another disputed election a decade ago.
In a nationally televised address, Kenyatta, 55, reached out to his opponents and appealed for calm, saying, "We are not enemies. We are all citizens of one republic.
"Let us always remember that we are brothers and sisters," he said. "Let us be peaceful. There is no need for violence. Your neighbor is your neighbor, regardless of their ethnicity."
Kenyatta won just over 54% of the vote Tuesday, compared with 45% for his rival, Raila Odinga, according to results released by the Independent Electoral and Boundaries Commission.
But leaders of the opposition National Super Alliance rejected the results before they were even announced, saying they had obtained figures from the commission's computer servers showing that Odinga won just over 50% of the vote.
"If they can open those servers, we are willing to accept the result based on what is in those servers," a senior opposition figure, James Orengo, told reporters. "There should be no rush to judgment ... The matter may not be closed as soon as some people think."
Wafula Chebukati, the electoral commission's chairman, declined to give opposition officials access to the computer system, saying he would deal with their concerns after the final results were declared.
Shortly before the official announcement, opposition leaders addressed reporters again and said they wanted no part in the results.
A senior opposition figure, Musalia Mudavadi, said the coalition had raised "very serious concerns" with the commission that had "not been adequately addressed."
Orengo called the result "a charade" and accused the electoral commission of violating Kenya's constitution. He said going to court was "not an option" and "Kenyans always rise up."
The result, which had been expected by midafternoon, came after darkness fell.
Soon afterward, there were reports of violent exchanges between opposition supporters and police, who responded with tear gas, and in some cases, live bullets, according to witnesses.
"Everybody is outside and protesting," said Petronella Achieng, a resident of Nairobi's Kibera slum who was reached by phone. "Police are chasing people out of the road, but people are also throwing stones back."
In Mathare, another volatile slum district, youths poured into the streets as soon as the result was announced and started attacking other people's homes, according to a local peace activist, Jakiwa Inda. "People are demonstrating, and there's a lot of tear gas," he said.
There were also reports of clashes in Kisumu, an opposition stronghold in western Kenya.
It was not immediately possible to confirm whether there were any casualties; at least three people were killed in clashes earlier in the week.
It is the third successive election that Odinga, 72, has lost and disputed. In a nation where ethnicity plays a large role in voter loyalties, and political power is often used to hand out jobs and patronage to ethnic allies, Odinga's Luo supporters feel marginalized and excluded.
Violence broke out across Kenya after a disputed election in 2007. Then-President Mwai Kibaki, a Kikuyu, had himself sworn into office in the dead of night, sparking ethnic killing that claimed some 1,500 lives.
The electoral commission's electronic vote tabulation system was intended to help restore confidence in the election process. But accusations by the opposition in recent days that the commission's computers had been hacked undermined the already fragile public trust in the system.
As the results were being counted this week, opposition officials repeatedly asserted that the figures displayed by the electoral commission differed from those on its server — a claim rejected by electoral officials. The opposition also alleged that the commission had not received about 11,000 of the official tally forms compiled at more than 40,800 polling stations.
The opposition has the option to challenge the result in court, although Odinga did so unsuccessfully in 2013. While campaigning this year, Odinga insisted that if he lost again, it meant that the election must be rigged, and he hinted that he might call for protests.
International observers have said that the vote appeared credible and have urged the opposition to pursue their allegations through legal channels.
Kenyatta, the son of Kenya's first president after independence from Britain, appeared jubilant Friday, waving from the roof of his limousine as he sped from his home to his party headquarters before the result was announced.
Wild celebrations broke out among Kenyatta's supporters as expectations about the result rose and continued into the night.
3:40 p.m.: This article was updated with reaction to the results and reports of violence breaking out.