It was supposed to be the most modern election in African history. Biometric identification kits with electronic thumb pads, registration rolls on laptops at every polling station, and an SMS-relayed, real-time transmission of the results to the National Tallying Center in Nairobi.
Ambitious? Of course. Only 23 percent of the country has access to electricity.
But Kenyans pride themselves on leapfrogging when it comes to adapting technology. A country without copper landlines, Kenya developed the world's most popular software for mobile money transfer. A native Kenyan platform for organizing and disseminating online citizen journalism has been deployed in more than 30 countries. Kenya may not have enough paved roads, but the country is constructing a $10-billion "Silicon Savannah" aimed at becoming the continental magnet for IT startups.
Among Kenya's wired middle class, the going wisdom was that politics was stuck in the past hopelessly mired in tribalism and corruption but that technology would breathe fairness and transparency into the process.
And then came Election Day and the triumph of Murphy's Law.
First the laptops ran out of battery power. Organizers had failed to consider that African school buildings, where many of the polling stations were situated, don't have electric outlets.
Then the biometric identification kits started to crash. Poll workers didn't have the PIN numbers and passwords they needed to restart the software. Paper ballots were rolled out and voter lines slowed to a crawl, forcing some voters to wait seven to nine hours in the hot sun to cast their ballots.
Voting concluded on Monday, but the tech hiccups did not. A bizarre computer bug multiplied the number of disqualified ballots by a factor of eight, leaving Kenyans livid and demoralized for several days in the belief that more than a quarter-million votes had been summarily tossed out in the incredibly tight race. The SMS-relay system overloaded, too, forcing election officials to airlift poll workers to Nairobi by helicopter to hand deliver the results.
The breakdown of the system delayed the announcement of a winner, creating more anxiety with each passing day in a country that experienced massive post-election violence in 2007. More than 1,200 people were killed and hundreds of thousands displaced.
At last, six days later, the Independent Electoral and Boundaries Commission (IEBC) announced the winner, former Deputy Prime Minister Uhuru Kenyatta by a squeaker: 50.07 percent a mere 8,000 votes out of a record-breaking 12 million cast.
The losing candidate, Prime Minister Raila Odinga, immediately challenged the result. There was "rampant illegality" in the electoral process, he said; these technical "glitches" were election rigging.
Yet an anonymous IT worker with the elections commission blogged a persuasive defense of why the glitches were, in fact, mere glitches. One Kenyan tech developer, Erik Hersman, sounded a note of soul-searching for the wider Kenyan tech community:
"It's been very troubling for me to see people speculating on social media about the IEBC tech system, claiming there have been hackers and all types of other sorts of seeming misinformation. Those of us in the technology space were looking to the IEBC and its partners for the correct information so that these speculative statements could be laid to rest. I deeply want the legitimacy of this election to be beyond doubt."
Could technology meant to uphold the credibility of this election end up subverting it?
International observers worried about a repeat of 2007, when the same losing candidate Odinga alleged a stolen election and triggered the wave of deadly tribe-on-tribe violence that lasted weeks.
This time, things took a different path. "Violence could destroy this nation and serves no one's interests," Odinga told his supporters on Saturday. He urged patience while his party takes their disputes to Kenya's Supreme Court.
The justice system had improved since 2007, he said, and was a more "trustworthy" institution than it had ever been.
It's an outcome that would have been hard to predict even a week ago: Faith in, of all things, Kenyan government institutions, could counter the spectacular betrayal of technology.