NAIROBI, Kenya — On a continent where military coups and rubber stamp elections have proliferated in recent years, Kenya stands out.
Despite its flaws and endemic corruption, the East African nation and economic powerhouse has steadily grown into a symbol of what is possible, its democracy underpinned by a strong Constitution and its hard-fought elections an example to other African nations seeking to carve a path away from autocracy.
But Kenya has just hit a speed bump.
On Monday, a winner was declared in its latest presidential election, ending an unpredictable battle that had millions of Kenyans glued to their televisions and smartphones as the results rolled in. William Ruto, the president-elect, beamed as he addressed a hall filled with roaring supporters, lauding the “very historic, democratic occasion.”
But the losing candidate, Raila Odinga, rejected the result even before it was announced. A fracas erupted in the hall where Mr. Ruto had been speaking, and where the votes had been counted, sending chairs and fists flying. And four electoral commissioners stormed out, casting doubt on a result that is almost certain to end up in court.
And so the election hangs in the balance, scrutinized not just at home but across a continent where Kenya’s rambunctious democracy is among those that are viewed an indicator of progress.
“We do not have the luxury to look back, we do not have the luxury to point fingers,” Mr. Ruto said. “We must close ranks to work together.”
It started out as a day of hope.
Early in the morning, several thousand people began packing into the giant hall in a Nairobi suburb to hear the election results, following an arduous six-day count that had the country on tenterhooks.
Mr. Ruto and Mr. Odinga had been neck-and-neck throughout the count, sometimes separated by as few as 7,000 votes, according to unofficial news media tallies. Those razor-thin margins left many nervous: Although its democracy is robust, Kenya’s elections can be vicious, and its last three contests were marred by disputed results that led to protracted crises, court cases and street violence that in 2007 killed over 1,200 people.
Chastened by those failures, the electoral commission had gone to extraordinary lengths to ensure a clean vote. Within 24 hours of polls closing last Tuesday evening, it had posted to its website images showing the results from nearly every polling station — over 46,000 of them.
But as Wafula Chebukati, the chief electoral commissioner, prepared to announce the winner on Monday, one of Mr. Odinga’s top aides called an impromptu news conference outside.
“This was the most mismanaged election in Kenya’s history,” Saitabao Ole Kanchory told reporters in a flurry of invective that described the counting center as “a crime scene” and called on those in charge “to be arrested.”
Moments later, pandemonium erupted inside the hall.
Supporters of Mr. Odinga, including Mr. Ole Kanchory, stormed the dais, throwing chairs on the floor and clashing with security officials brandishing truncheons. Foreign diplomats and election observers fled to a backstage area — but a choir that had been belting out gospel songs for much of the day continued to sing.
Once the situation calmed, Mr. Chebukati emerged to deliver a short speech in which he noted that two of his commissioners had been injured in the melee — and others harassed, “arbitrarily arrested” or disappeared — before proceeding to announce the results.
Mr. Ruto received 50.49 percent of votes, he said, against 48.85 percent for Mr. Odinga, a difference of just 233,211 votes but enough to avoid a runoff.
In a speech that appeared intended to project authority and offer reassurance, Mr. Ruto thanked his supporters and voted to work for the good of Kenya. He promised to set aside the bitterness of the campaign — and the chaotic scenes minutes earlier — to concentrate on the country’s flailing economy.
“There is no room for vengeance,” Mr. Ruto said, flanked by his wife and by his running mate, Rigathi Gachagua. “Our country is at a stage where we need all hands on deck to move it forward. We do not have the luxury to look back.”
Celebrations erupted in the streets of Eldoret, a stronghold for Mr. Ruto in the Rift Valley, where there was a deafening cacophony of horns, whistles and chants filling the downtown area.
But in much of the country, his victory was overshadowed by a major development: Four of the seven electoral commissioners refused to verify the vote, defying Mr. Chebukati and decamping to a luxury hotel where they denounced “the opaque nature” of the final phase of the count.
Those commissioners, it turned out, had been appointed by Mr. Odinga’s most prominent ally in the race, President Uhuru Kenyatta, who is barred by term limits from running again.
Speaking to journalists a few hours later, Mr. Ruto dismissed their declaration as a “side show.” Under Kenyan law, he said, Mr. Chebukati alone is responsible for declaring the winner.
“Legally, constitutionally, the four commissioners pose no threat at all to the legality of the declaration,” Mr. Ruto said.
Still, the drama suggested that a day that should have signaled the end of the presidential contest might end up being just another chapter in the nail-biter race that has had Kenyans on the edge of their seats since the vote on Tuesday.
The candidates were a study in contrasts.
Mr. Odinga, 77, a leftist from one of Kenya’s most storied political dynasties, made his first bid for the presidency in 1997. He ran three more times, always losing, before trying again this year.
Although he did once serve as prime minister, Mr. Odinga’s electoral defeats embodied the broader frustrations of his ethnic group, the Luo, which has never controlled the Kenyan presidency in all the years since the nation gained independence from Britain in 1963.
Mr. Ruto, 55, the country’s vice president and a wealthy businessman, cast himself as champion of Kenya’s “hustler nation” — the disillusioned, mostly young strivers struggling to gain a foothold. He frequently told voters about his humble origins, including a barefoot childhood and an early career selling chickens on the side of a busy highway.
That image contrasted with Mr. Ruto’s considerable wealth, which has grown during his political career to include a luxury hotel, thousands of acres of land and a large poultry processing plant.
While the “hustler” pitch resonated powerfully with some Kenyans, others just shrugged. Just 40 percent of Kenyans under 35 registered to vote in this election, and the 65 percent turnout was sharply down from the 80 percent reported in the 2017 election.
The low turnout appeared to be a rejection of what many saw as a bad choice between candidates from their country’s discredited political elite.
In voting for Mr. Ruto, millions of Kenyans overlooked the charges he once faced at the International Criminal Court, which a decade ago accused him of whipping up the storm of violence after the 2007 election that nearly pushed Kenya into a civil war.
The charges included murder, persecution and forcing people to leave their homes, but the case collapsed in 2016. The Kenyan government — Mr. Ruto was vice president — engaged in what the court said was “witness interference and political meddling.”
Mr. Ruto was running not just against Mr. Odinga but, in effect, against his own boss, Mr. Kenyatta, whom he accused of betrayal for backing Mr. Odinga.
Instead of delivering votes for his chosen successor, Mr. Kenyatta suffered a humiliating rebuke from voters in his heartland, the Mount Kenya region, where ethnic Kikuyus rejected his allies across the board. Even at the polling station where Mr. Kenyatta cast his vote on Tuesday, Mr. Ruto scored a sweeping majority, the results showed.
Debilitating economic troubles provided a bleak backdrop to Tuesday’s vote. The tourism-reliant economy has been battered in recent years, first by the coronavirus pandemic, then by Russia’s assault on Ukraine, which caused food and fuel prices to rise even more amid a global downturn.
“Maize flour, cooking oil, cooking gas — everything is going up,” Abzed Osman, an actor who also works in tourism, said as he stood in line to vote on Tuesday in the Nairobi district of Kibera, Africa’s largest shantytown.
By Monday evening in Kisumu County, one of Mr. Odinga’s strongholds in western Kenya, hundreds of protesters who had been eagerly awaiting the results began demonstrating and burning tires, witnesses said.
Hours later a spokesman for Mr. Odinga, Dennis Onsarigo, said the candidate planned to address the nation on Tuesday.
Declan Walsh and Matthew Mpoke Bigg reported from Nairobi, and Abdi Latif Dahir from Eldoret.