In his final weeks as president, Uhuru Kenyatta has been busier than usual playing peacemaker in East Africa, thawing tensions with Somalia, intervening in Congo's crisis, and hosting talks between Sudan and Ethiopia.
His enthusiasm for statesmanship has not gone unrecognised -- Kenya's departing leader was recently awarded the national order of Burundi, and gifted a resplendent sash from fellow presidents for his regional diplomacy.
But with Kenyatta leaving office after almost a decade, Kenya's allies are anxiously wondering what is next for a country that has evolved into a trusted ally and democratic anchor in a troubled region.
The August 9 election to replace Kenyatta, who cannot run for a third term, has elevated tensions and evoked the spectre of instability that has plagued Kenya's votes.
Diplomats and foreign observers say a peaceful transfer of power remains uncertain, and that Kenya's coveted reputation as a reliable and stable partner faces a keen test as voters head to polling booths.
The frontrunners, William Ruto and Raila Odinga, have pledged to concede defeat if the election is free and fair.
But both candidates have been accused of inciting previous electoral violence, and the race is too close to call, raising jitters in Western capitals as the high-stakes transition draws near.
- Reliable partner -
Foreign partners have increasingly relied on Kenya as a steady hand in East Africa, and fear an internal crisis would deprive the region of stability and leadership at a critical time.
"Weak states, feuding states, can't play the role of a diplomatic anchor," said Cameron Hudson, a former US official now senior associate at CSIS Africa.
He said Kenya had surpassed Ethiopia as the region's "new diplomatic powerhouse" since Kenyatta took office in 2013.
This has seen Kenyatta personally intervene in crises where regional institutions such as the African Union and IGAD -- both historically close to Addis Ababa -- have been slow to act.
Late last year, as a rebel advance on Ethiopia's capital provoked international alarm, Kenyatta flew unannounced to Addis Ababa to urge Prime Minister Abiy Ahmed to find a peaceful solution.
The rebels from the northern Tigray region said in July that any potential ceasefire talks must be mediated by Kenyatta -- not the African Union, which is headquartered in Addis Ababa.
In June, as eastern Congo spiralled into violence, Kenyatta called East African leaders to his official residence, proposing that Kenya oversee a regional peacekeeping mission to the conflict zone.
Internationally, too, Kenya has sought to project greater influence and stand on its own.
In February, as other African states responded with equivocation, Kenya strongly condemned Russia's aggression in Ukraine at the UN Security Council, where Nairobi sought and won a temporary seat two years earlier.
- Passionate emissary -
Such interventions have been warmly welcomed by foreign allies including the United States, which bases troops in Kenya, and needs its support countering violent Islamists in Somalia.
Washington valued Kenyatta as a trusted envoy in regional crises where they had made little headway, analysts said.
"He is probably the African leader the US president has spoken to the most," Hudson said.
Washington is "investing a great deal to ensure that stability continues through these elections", he added.
Ruto and Odinga flew to London and Washington earlier this year to assure policymakers that Nairobi would continue to play a pivotal role in the region.
Diplomats say there is unlikely to be major foreign policy changes under either candidate.
"But it will not be a priority," said Macharia Munene, professor of history and international relations at the United States International University in Nairobi.
"I don't think either Raila or Ruto have the passion for this sort of thing, whereas for Uhuru, it's a passion."
In any case, he said Kenyatta's successor would have "bigger fish to fry" than dealing with regional headaches.
East Africa's largest economy is saddled with debt and the next administration could be pressured by international lenders to slash populist subsidies despite having promised to bring down prices.
"We're just concerned about how much time Kenya will be able to spend on foreign policy and regional mediation, if it's grappling with so much at home," said Meron Elias, an analyst at the International Crisis Group.
- 'Everybody nervous' -
Kenya's international standing couldn't have been worse when Kenyatta took office in 2013 despite -– or perhaps because of -– being indicted by the International Criminal Court on crimes against humanity.
The new administration was accused of frustrating the investigation into Kenyatta and his deputy, Ruto, over their alleged role in orchestrating the 2007 post-election violence that left over 1,100 people dead.
The cases against the pair -– who campaigned on a platform of nationalism and confronting the ICC -– were dropped, with prosecutors citing a lack of evidence and relentless witness intimidation.
There are fears "the relationship which has improved in the last few years could go sideways again" depending how the transition plays out, said a US analyst and veteran observer of Kenyan elections who declined to be named.
"Everybody is obviously nervous," the analyst said.