In this July 13, 1990 file photo, South African leader Nelson Mandela, left, and Kenya's President Daniel arap Moi wave to the crowd at a public rally for the African National Congress in Nairobi, Kenya. (AP)
Former Kenyan President Daniel Arap Moi died aged 95, leaving behind a country still riddled by corruption that became rampant during his rule over the East African nation from 1978 to 2002.
Usually pictured carrying an ivory baton, Moi was Kenya's longest serving leader. Critics described him as a virtual dictator, but despite its poverty Kenya was more stable than many other countries in the region emerging from colonial rule.
Moi succeeded statesman and independence leader Jomo Kenyatta, having served as his vice president. Diplomats said he was transformed from a cautious, insecure leader into a tough autocrat following an attempted coup after four years after he came to power.
He set up torture chambers in the basement of Nyayo House, a government building in Nairobi's city centre that now houses the immigration department.
Thousands of activists, students and academics were held without charge in the underground cells, some of them filled with water. Prisoners were sometimes denied food and water, rights groups say.
He won elections in 1992 and 1997 amid divided opposition. But he was booed and heckled into retirement when term limits forced him to step down in 2002 and lived quietly for years on his sprawling estate in the Rift Valley.
Scandals and Politics
Born a cattle herder's son in a village 200 km (125 miles) northwest of Nairobi in 1924, Moi was a headmaster before entering politics in the 1950s.
He succeeded in keeping Kenya relatively stable compared to many of its troubled neighbours, worked for regional peace and eventually introduced political pluralism.
But he floundered badly on the economy, failing to tackle deepening poverty and rampant graft.
One major scandal on his watch, "Anglo Leasing", began in the 1990s and involved state contracts worth hundreds of millions of dollars being awarded to non-existent firms. Another scam, "Goldenberg," led to the loss of at least $1 billion from the central bank money via compensation payments for bogus gold and diamond exports.
The economy nosedived in the late 1990s as tea and coffee prices slid. Donors froze lending, citing graft concerns. Crumbling infrastructure scared off investors.
Moi pulled the strings of Kenya's tribal politics throughout his rule, despite having an uncharismatic presence, and was often underestimated by less canny opponents.
He belonged to the small Kalenjin tribe but kept control through links to other small tribes, exploiting their fear of domination by large communities such as Kikuyus and Luos.
He resented the Kikuyus' attempts to block his appointment as president when Kenyatta died and made scores of prominent business and political appointments from his ethnic group.
Sing like a parrot
Kenya's only coup attempt did immense damage to the country's reputation for stability and Moi soon changed the constitution to legalise de-facto one-party KANU rule. Moi retained symbols of democracy such as regular parliamentary elections but critics said government interference was so pervasive that Kenya was a virtual dictatorship.
He chipped away at parliament's authority and exercised almost unlimited power. "Everyone should sing like a parrot after me," was one of his frequent sayings.
Moi barely survived demands for his resignation over the 1990 murder of Foreign Minister Robert Ouko, a key Luo leader. In 2010, a government inquiry into the death, presented to parliament five years after it was written, said the murder was carried out in one of Moi's official residences.
Under international attack for rights abuses and corruption, Moi announced in 1991 that multi-party polls would be held for the first time in 25 years. But the opposition remained divided.
In 2002, Moi surprised all observers by allowing free elections that dealt his youthful protege Uhuru Kenyatta a crushing defeat.
"That is the way democracy goes," Moi said after results were announced.
Kenyatta, son of the country's first president, was finally elected president in 2013 and is serving his second and final term.
Even though Kenyan prosecutors are still pursuing graft cases dating back to Moi's time, he was often seen as a respected elder statesman. His style softened markedly in his last days in office.
"I forgive those who have hurled insults at me," Moi said in his last national day speech in 2002. "If I have said anything that has hurt your heart, forgive me."