Kenya's former President Daniel arap Moi has died at the age of 95.
President Uhuru Kenyatta announced his death, saying the nation had lost a "great man".
Mr Moi was Kenya's longest-serving president. He was in office for 24 years, until intense pressure forced him to step down in 2002.
His critics saw him as an authoritarian ruler who oversaw rampant corruption, but his allies credited him for maintaining stability in the country.
In 2004, Mr Moi asked for forgiveness from "those he had wronged".
What has been the reaction?
President Kenyatta has declared a period of mourning, including the flying of flags at half-mast, until a state funeral is held for Mr Moi. No date has been set for the funeral.
Mr Kenyatta said the continent was "immensely blessed by the dedication" of the late president, who spent "almost his entire adult life serving Kenya and Africa".
Uganda's President Yoweri Museveni said Mr Moi was a "true pan-Africanist", while Tanzania's President John Magufuli said he would be remembered for promoting regional integration.
Kenya's former Prime Minister Raila Odinga, who was detained by the Moi regime for campaigning for multi-party democracy, praised him for introducing "incremental" reforms said that in retirement the former president had "conducted himself with complete dignity befitting an elder statesman".
On Twitter, some Kenyans were less forgiving:
Daniel Moi orchestrated the largest theft of tax payer coffers in the 90's.— Michael Mburu (@MichaelMburu_) February 4, 2020
Over 100 Billion KShs was stolen via the Goldenberg scandal.
He oversaw a torture program that KILLED Kenyans.
Yet Kenyans have the nerve to praise this guy? 🤦🏾♂️#RIPMoi#RIPPresidentMoi
Daniel Arap moi brutally murdered Dr. Robert Ouko Seda. To Moi, anyone who opposed his regime was writing their own orbituaries. Rest in peace wuod Nyahera. To the hypocrites praising Moi shame on you #RIPPresidentMoi pic.twitter.com/b75LjNTWMj— odhiambo odhiambo (@wyckliffeowiti) February 4, 2020
Others praised Mr Moi for his focus on improving the health of schoolchildren.
In the 1980s and 1990s, the ministry of education distributed free packets of milk to all primary schools, targeting children under the age of 13.
How did he die?
Mr Moi died with his son Gideon at his bedside at a private hospital in the capital, Nairobi, of an unspecified illness.
"He passed away peacefully," Gideon Moi said.
"I have seen a steady decline. His decline was very worrying. He has been hospitalized since October 10th 2019 and has never left hospital," Mr Moi's former press secretary Lee Njiru told Kenya's privately owned Citizen TV.
Mr Moi is survived by eight children. He and his late wife, Helena Bomett, divorced in 1979.
Dickens Olewe, BBC News Online
The debate about how Kenyans will mourn the former president began long before he succumbed to his recent health problems.
The 95-year-old was loved and loathed in equal measure; his supporters will mourn him as a patriot and a consummate politician who they fondly nicknamed "professor of politics", but others will choose to remember him as a brutal dictator.
Defenders of Mr Moi will point to his often-repeated line that he kept Kenya "safe and peaceful", noting that while several African countries were imploding into civil war the country remained stable.
Whichever version is favoured, the legacy of one of the last surviving independence leaders lives on as many of today's top politicians, including President Kenyatta and his deputy, William Ruto, were protégés of the second president.
Kenya has changed a lot since Mr Moi left office but his influence will continue to be felt for a long time.
Who was Danial arap Moi?
Born on 2 September 1924, he was originally known as Torotich arap (meaning son of) but adopted the name Daniel when, as a schoolboy, he was baptised by Christian missionaries.
He was a close ally of Jomo Kenyatta, who became Kenya's first president and is the father of Kenya's current leader.
Kenya's longest-serving president
1924born in farming community
1982coup attempt foiled
2002steps down as president
2020dies in Nairobi
When he became president of the one-party state, he appeared to dominate almost every aspect of life, an impression aided by the state-run media.
The 1982 attempt to overthrow him led to a brutal crackdown on his opponents. He also scrapped the entire air force, whose members had taken part in the foiled coup.
He was forced to adopt a multi-party system of government in 1991, following mass protests and diplomatic pressure from Western powers.
Constitutionally barred from seeking a third term in office, he agreed to a peaceful transfer of power to Kenya's third President, Mwai Kibaki, in 2002.
His critics see his rule as the lost years. They say he stymied economic progress by personalising the state, using government resources to award loyalists and withholding them to punish those who did not toe the line.
For example, roads and factories were seen as gifts to be given and rewards for communities if their top politicians worked with the ruling party, Kanu. This entrenched a culture of political patronage that has become part of Kenyan politics.