NAIROBI, Kenya — Despite chaos and a physical attack on Kenya's top elections official, the country's elections commission has announced that Deputy President William Ruto will be the East African nation's fifth president.
In an election marked by high drama and shifting alliances, Ruto triumphed over Raila Odinga, Kenya's longtime opposition leader who had forged an alliance with outgoing President Uhuru Kenyatta that his supporters thought guaranteed him the presidency.
But after six days of counting and just as the electoral commission was ready to announce a final tally on Monday, four out of the seven electoral commissioners walked out of the main tallying center in Nairobi, saying they could not support the final result because of the "opaque nature" of the vote count.
The commission's chairman, Wafula Chebukati, went on stage anyway and chaos ensued. He was attacked by a senator. Others jumped on the stage, ripped banners, tipped over the lectern and attacked the remaining electoral commissioners.
Two of them were injured, but Chebukati returned to the stage once more and declared that Ruto had won narrowly with 50.49% of the vote to Odinga's 48.85%.
"We have a constitutional duty to perform," he said. "That is why I stand before you today despite the intimidation and harassment. I took an oath of office to serve this country and I have done my duty in accordance with the constitution and the laws of the land."
Kenya is a model of democracy in East Africa, a region where authoritarianism has been ascendant. These elections had been hailed as step forward for Kenyan democracy because the campaign was marked by political maturity. Politicians focused on economic issues, instead of the tribal mobilization that have been a feature of every Kenyan election since independence.
And these elections also began as the most transparent in the country's history. Just hours after voting finished, the electoral commission began publishing raw voting data from more than 46,000 polling stations. That meant anyone could tally the votes and check the electoral commission's math.
In his first speech as president-elect, Ruto spoke of reconciliation. He said he would not seek revenge against his political adversaries and called on Kenyans to work together.
"I want to promise the people of Kenya that I will run a democratic government and I will work with the opposition to the extent that they oversight the government," Ruto said.
But across the capital city, scenes of celebration mixed with anger. In the city's two biggest slums — Mathare and Kibera — protests turned violent. In Mathare, a woman was killed after a crowd threw stones at her car and it flipped over.
In Kibera, protesters set fires in the middle of the streets and mobs destroyed roadside stores.
"We are angry," Jared Ochieng, 55, said as he watched the flames from afar. "This is not what we expected. Now, what can help Kenya is to go for another election."
Odinga, the opposition leader, did not appear in public, but his running mate, Martha Karua, tweeted, "It is not over till it is over."
Odinga now has seven days to lodge an appeal before the country's constitutional court.