Former Zambian president Kenneth Kaunda was a hero of the struggle against white rule in southern Africa, but lost his hold on power when democracy spread across the continent.
Kaunda, who was admitted to hospital on Monday for pneumonia and died Thursday aged 97, ruled for 27 years and was one of the last remaining African liberation heroes.
He became the first foreign head of state to be visited by South African liberation icon Nelson Mandela on his release from prison in 1990.
But the following year, Kaunda was ditched by Zambian voters when he was pressured into scrapping decades of one-party rule and holding multi-party elections in the copper-rich but impoverished country.
Kaunda, who came to power in 1964 when the former Northern Rhodesia won independence from Britain, nationalised mines and other key industries, but his policies proved economically disastrous.
His support for liberation movements in the region, including hosting Mandela's African National Congress (ANC) in exile, also saw the country come under pressure from its bigger neighbours and hurt the copper-rich economy by cutting important export routes.
Although his own nationalist career had been essentially non-violent, and earned him the moniker "African Gandhi", Kaunda backed the armed struggles against minority white rule in South Africa, Angola, Mozambique and Southern Rhodesia (now Zimbabwe).
Despite this, he maintained generally good relations with Western powers, proving to be a valuable intermediary in talks with nationalist guerrilla groups.
He famously danced with Britain's "Iron Lady" prime minister Margaret Thatcher -- no friend of the liberation movements -- at a Commonwealth conference in Lusaka in 1979.
Widely known as KK, his warm personality and trademark white handkerchief, often used to dab his eyes during an emotional speech, made him a colourful and well-known character in the struggle against apartheid.
Ex-vice president Guy Scott recalled a visit to South Africa with Kaunda and how "amazing" it was while passing through the airport in Johannesburg "because everybody wanted to have themselves photographed with Dr Kaunda".
Kaunda himself recalled several fruitless meetings with white South African leaders over apartheid before talks with president F.W. de Klerk, who later freed Mandela.
"Then came my meeting with F.W. de Klerk... and after a few hours I called a press conference where I said 'I think I can do business with this man'. Thank goodness he released this great man."
But at home Kaunda had become increasingly autocratic and, as democracy flowered across Africa with the thawing of the Cold War, he was forced to hold multi-party elections in 1991.
He was ousted by labour leader Frederick Chiluba and his Movement for Multiparty Democracy.
Kaunda was loathe to give up hope of returning to power, telling reporters that he hoped his initials would eventually come to stand for "Komeback Kid".
But Chiluba, determined to block Kaunda, introduced a law preventing the children of foreign nationals from standing in elections. It was specially targeted at Kaunda, whose parents were from Malawi.
On Christmas Day, 1997, Kaunda was arrested in connection with an alleged coup plot against Chiluba. He was imprisoned and then held under house arrest until June 1998 when the charges were dropped.
In retirement, Kaunda emerged as a respected voice of experience on the continent, from mediating in conflicts to his frank approach to the AIDS epidemic after acknowledging that the disease had killed one of his own sons.
Kaunda was born the youngest of eight children of a Presbyterian minister on April 28, 1924 at Lubwa mission in the north of the then Northern Rhodesia.
He taught at Lubwa from 1943 to 1947 before moving to the Copperbelt mining area, where his political career developed as he sought to end the racial discrimination of the colonial regime.
In the 1950s, he organised boycotts of butchers discriminating against blacks and became a founding member of the Zambia African National Congress (ZANC).
He vowed not to eat meat until his country had majority rule, but even after independence in 1964 remained a vegetarian.
He later joined the United National Independence Party (UNIP), and led it to victory in elections at independence.
"Zambia cannot be what it is without your contribution," President Edgar Lungu said during Kaunda's 97th birthday celebrations in April 2021.
Kaunda had nine children with his wife Betty, who died in 2012.
He enjoyed ballroom dancing and ocassionally played the guitar and sang romantic tunes to his wife.