But when the ballot counting began this week, Uhuru Kenyatta, the son of Kenya’s first president, surged ahead in the race for president and stayed out front as the margin narrowed early on Friday. Soon, the Obama administration and its allies could face a tough choice, made even more complicated by the appearance of taking sides against a candidate who may very well win.
Does the United States put a premium on its commitment to justice and ending impunity — as it has emphasized across the continent — and distance itself from Mr. Kenyatta should he clinch this election?
Or would that put at risk all the other strategic American interests vested in Kenya, a vital ally in a volatile region and a crucial hub for everything from billion-dollar health programs and American corporations to spying on agents of Al Qaeda?
Even the little things could be tricky. Are the American diplomats who interact with the Kenyan government on a daily basis not supposed to shake Mr. Kenyatta’s hand? What about sharing a dais with him? The British have already publicly stated that they will avoid any contact unless it is essential.
“This is going to pose a very awkward situation,” said Jendayi Frazer, a former assistant secretary of state for African affairs. “Kenyatta knows he needs the United States, and the United States knows it needs Kenya.”
American officials have declined to discuss publicly what a Kenyatta victory would mean, and several reiterated the rather anodyne video message from President Obama in February, in which he said, “The choice of who will lead Kenya is up to the Kenyan people.”
But Johnnie Carson, the top administration official for Africa, was not quite so diplomatic when he repeatedly warned soon after that “choices have consequences,” which critics say backfired by energizing supporters of Mr. Kenyatta and his running mate, William Ruto, driving many to the polls to rally behind them. “When you inject yourself into an election,” Ms. Frazer said, “you never know how it will play.”
Mr. Carson responded, “One comment does not swing a contest.”
If he wins the presidency, Mr. Kenyatta, who was leading with 50 percent of the vote on Friday, would become the second African head of state after Sudan’s Omar Hassan al-Bashir to face grave charges at the International Criminal Court at The Hague. But that does not mean he will meet the same diplomatic isolation as Mr. Bashir, who is wanted on an arrest warrant and cannot travel to much of the world.
For starters, Mr. Bashir has refused to appear at the court, while Mr. Kenyatta has traveled there to defend himself, so no warrant has been issued. Beyond that, the United States and Sudan were hardly allies when Mr. Bashir was accused of fomenting genocide in Darfur. The relationship was already sour, with Sudan squeezed by sanctions for playing host to Osama bin Laden, among other things.
By contrast, the American-Kenyan partnership has been a particularly symbiotic one, especially recently. American intelligence agents work closely with their Kenyan counterparts, hunting down Qaeda cells in Kenya and Somalia. Kenya receives nearly $1 billion in American aid each year and has agreed to accept captured Somali pirates and hundreds of thousands of refugees, at the request of donors like the United States.
Nairobi, Kenya’s capital, is home to the largest American Embassy in sub-Saharan Africa and a sprawling United Nations campus that runs programs across the world, making it especially difficult for the United States to take its resources somewhere else.
“There is really very little leverage that the U.S. and other countries can exercise,” said J. Peter Pham, director of the Michael S. Ansari Africa Center in Washington.
One former American official with extensive experience in Africa was more blunt. “We need Kenya more than Kenya needs us,” he said.
The United States has to be careful how it handles the Kenyatta issue, analysts say, because Mr. Kenyatta could easily turn to China, which has made important inroads here, building highways and even covertly financing some Kenyan military operations.
Already, the Western concerns about Mr. Kenyatta’s candidacy seem to be provoking a backlash.
On Wednesday, the Kenyatta campaign accused the British high commissioner here of “shadowy, suspicious and rather animated involvement” in Kenya’s election, a claim the British dismissed as “entirely false.”
Some diplomats have also spoken of what they call a “Mugabe factor,” warning that Kenya’s leaders, if put under too much pressure, could become isolated and testy like President Robert Mugabe of Zimbabwe.
Court documents paint a disturbing picture of Mr. Kenyatta. According to prosecutors, as hundreds of his fellow Kikuyus were being slaughtered by rival ethnic groups in the explosion of violence after the last major election in 2007, Mr. Kenyatta organized meetings with a nefarious Nairobi street gang to take revenge.
Mr. Kenyatta, the documents say, “contributed money towards the retaliatory attack” and was “aware of the widespread and systematic nature of the attack.” The outlawed gang, the Mungiki, killed scores of people, including small children burned to death while huddling in their homes.
Mr. Kenyatta has denied the charges and says he will clear his name. Many analysts say the case is rather weak. The trial was supposed to start next month but has been postponed until July.
The case against Mr. Ruto, a charismatic politician with an intensely loyal following, is believed to be stronger. Prosecutors say Mr. Ruto and his inner circle “created a network of perpetrators” and paid them to kill.
There are few figures in the Kenyan political landscape as polarizing as Mr. Kenyatta, 51, a deputy prime minister. Many members of other ethnic groups accuse him and his family of stealing their ancestral land, which became the basis for the Kenyatta family fortune.
But among many Kikuyus, Mr. Kenyatta is seen as a savior. He is a confident speaker, educated at Amherst College and respected in Nairobi’s business circles. During the last election crisis, several supporters said, he paid for buses to ferry Kikuyus out of danger zones and bought sacks of food for families who had been burned out of their homes.
“When we needed it, Uhuru was there,” said David Wanjohi Chege, a trader.
Many Western governments would clearly prefer the second-place candidate, Prime Minister Raila Odinga, who was trailing with 45 percent of the vote Friday amid complaints from his camp that some results had been “doctored.” The race may be headed for a runoff.
Diplomats in Nairobi said they did not know what their governments would do if Mr. Kenyatta ultimately won — though most expected little or no change in policy unless he was convicted or stopped cooperating with the court. If that happens, some diplomats spoke of targeted sanctions without wanting to be more specific.
“To be honest, there are so many different scenarios, nobody really knows what we’re going to do,” one American official said.
The United States has opted not to participate in the International Criminal Court, though the administration has expressed support for “the I.C.C.’s prosecution of those cases that advance U.S. interests and values.” Many Kenyans see this as hypocritical.
Mr. Kenyatta’s lawyers could probably drag out the trial for years. The only conviction the court has secured, against a Congolese warlord, came six years after he arrived at the court.
Some Kenyans have worried that Mr. Kenyatta, if he wins, may try to pull Kenya out of the court to evade trial. But according to legal scholars, that would not change Kenya’s obligations.
“The I.C.C. was definitely a factor in this election, but not necessarily the factor you would expect,” said Maina Kiai, a prominent Kenyan human rights defender. “It got people out. People were saying, ‘They’re our boys, they’re our sons, we need to protect them.’ ”