NAIROBI, Kenya — Kenya’s vice president, William Ruto, won the country’s presidential election, the head of the electoral commission said Monday, days after a cliffhanger vote in a country that is pivotal to the economy and security of East Africa.
Mr. Ruto gained 50.5 percent of the vote, narrowly defeating Raila Odinga, a former prime minister, said the chairman of the Independent Electoral and Boundaries Commission, Wafula W. Chebukati. That percentage is enough to avert a runoff vote.
But minutes before the result was announced, four of the seven commission members said they could not verify the outcome. The statement immediately raised questions about the legitimacy of the result, and is likely to feature in any challenge in Kenya’s Supreme Court by supporters of Mr. Odinga
A legal challenge could, in the short term, prolong a period of uncertainty in a nation whose democracy is closely watched by the continent and the world.
Kenyan law allows for an election result to be challenged within one week — a prospect that many observers viewed as a near certainty.
Soon after the results were announced, Mr. Ruto gave a speech in which he accepted victory, thanked his supporters and vowed to work for the good of the country.
“There is no room for vengeance, there is no room for looking back, we are looking into the future,” he said. “I am acutely aware that 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 broke out in the streets of Eldoret town, a stronghold for Mr. Ruto in the Rift Valley, with a deafening cacophony of cars and motorcycle honks, whistling and screaming taking over the streets in the downtown area.
Speaking to journalists later, Mr. Ruto dismissed the declaration by the four electoral commissioners as a “side show.” Under the law, he said, the election results could be declared by Mr. Chebukati and nobody else.
“Legally, constitutionally, the four commissioners pose no threat at all to the legality of the declaration,” he said.
Mr. Ruto, 55, a wealthy businessman, has cast himself as the champion of Kenya’s “hustler nation” — the disillusioned, mostly young strivers struggling to gain a foothold. His announced victory appears to be a repudiation of his boss, President Uhuru Kenyatta, who had campaigned for Mr. Odinga.
But a question mark now hangs over the outcome because of the statement the vice chairwoman of the electoral commission, Juliana Cherera, made moments before the election results were announced. She said she was speaking on behalf of four of the country’s seven commissioners who could not take ownership of the results because of the “opaque nature” of the election’s handling.
In Kisumu County, a major stronghold for Mr. Odinga, hundreds of protesters who had been eagerly awaiting the results announcement, began demonstrating and burning tires, witnesses said.
For his part, Mr. Odinga, who had run for president four times before, had been exceptionally critical of the vote count process even before the declaration of results.
“This was the most mismanaged election in Kenya’s history,” Saitabao Ole Kanchory, Mr. Odinga’s chief electoral agent, told reporters outside the national tallying center. He called the counting center in Nairobi “a crime scene” and said those in charge of the count “ought to be arrested.” He made no immediate reaction to the declaration of Mr. Ruto’s victory.
Defeat would be a stinging blow also for Mr. Odinga’s region in western Kenya, as well as for his fellow ethnic Luos. Many of them say Luos have been unfairly excluded from the presidency since independence, and that Mr. Odinga was denied victory in 2007, when vote counting showed him leading, before he was eventually declared the loser.
That election led to ethnic and political violence in which more than 1,200 people were killed and tens of thousands of others were forced to flee their homes.
Declan Walsh and Matthew Mpoke Bigg reported from Nairobi, and Abdi Latif Dahir from Eldoret, Kenya.