image copyrightGetty Images
Kenneth Kaunda was one of the pioneer leaders of a new Africa, as countries threw off colonialism in favour of independent statehood.
A man of great personal charm, he was hailed as a modernising force in the continent despite his initial rejection of the concept of multiparty democracy.
As a committed pan-Africanist, he began the task of building a new Zambia, free to determine its own way in international affairs.
But poor economic management caused his popularity to plummet, and he was voted out of office when free elections were held in 1991.
Kenneth David Kaunda was born on 28 April 1924 at a mission station near the border between what was then Northern Rhodesia and the Congo.
image copyrightGetty Imagesimage captionKaunda was strongly influenced by the policies of Martin Luther King
His father, an ordained Church of Scotland minister, died while he was still a child, leaving the family in straitened circumstances.
But the young Kaunda's academic ability won him a place in the first secondary school to be formed in Northern Rhodesia, and he later became a teacher.
His work took him to the country's Copperbelt region and to Southern Rhodesia, now Zimbabwe, where for the first time he experienced, and deeply resented, the full impact of white domination.
One of his first political acts was to become a vegetarian in protest at a policy that forced Africans to go to a separate window at butchers' to buy meat.
In 1953 he became the general secretary of the Northern Rhodesian African National Congress but the organisation failed to mobilise black Africans against the white-ruled Federation of Rhodesia and Nyasaland.
image captionKaunda appearing on the BBC's Brains Trust in 1960
Two years later he was imprisoned, with hard labour, for distributing leaflets that the authorities deemed subversive.
Disillusioned with what he saw as the failure of his party to take a stronger line on the rights of indigenous Africans, Kaunda set up his own party, the Zambian African National Congress.
Within a year it was banned and Kaunda was back in prison. His incarceration turned him into a radical.
By 1960 he had become the leader of the new United National Independence Party (Unip) and, fired with enthusiasm following a visit to Martin Luther King in the US, he began his own programme of civil disobedience which involved blocking roads and burning buildings.
Kaunda stood as a Unip candidate in the 1962 elections which saw an uneasy coalition with the African National Congress (ANC) take power in the legislature.
image copyrightGetty Imagesimage captionHe became the first Prime Minister of the newly created Northern Rhodesia
The Federation of Rhodesia and Nyasaland was dissolved at the end of 1963 and, a month later, Kaunda was elected prime minister of Northern Rhodesia. The country, renamed as Zamia, gained full independence in Oct 1964 with Kaunda as its first president.
Kaunda started with the great advantage of leading an African state with a stronger economic base than any of its neighbours but there was a shortage of native Zambians who had the skills and training to run the country.
His position was also gravely imperilled by Ian Smith's unilateral declaration of independence in Southern Rhodesia.
The policy of sanctions imposed by the British government on the breakaway country proved at least as damaging to the Zambian economy.
In the circumstances, Kaunda found it increasingly difficult to sustain his reputation for moderation – though his calls for British military intervention were no shriller than those of leaders of other African states whose interests were less directly threatened.
In 1969, at huge cost, he nationalised the copper mines, which accounted for 90% of the country's foreign exchange earnings. But the price of copper collapsed, imported oil prices soared, and the economy, already weakened, was soon in serious trouble.
image copyrightGetty Imagesimage captionA fall in the price of copper undermined the Zambian economy
At the time of independence Zambia was one of the richest countries in sub-Saharan Africa, but by 1991 it had debts of $8bn.
Kaunda was not slow in taking a firm line against political opposition. In 1972 he declared a one-party state, a situation that was not relaxed until 1991, when free elections were held.
"It would have been disastrous for Zambia if we had gone multiparty," he once said, "because these parties would have been used by those opposed to Zambia's participation in the freedom struggle."
As chairman of the six frontline states in the campaign against apartheid, he led opposition first to Ian Smith in Rhodesia and then the regime in South Africa.
Nevertheless, he continued to work for a settlement in Rhodesia, and had meetings with South African leaders John Vorster, PW Botha and FW de Klerk.
He harboured political exiles from South Africa in his country, and clashed with Margaret Thatcher in particular, over her opposition to sanctions against the apartheid regime. It was an issue that threatened the very future of the Commonwealth.
image copyrightGetty Imagesimage captionHe worked with South Africa's leaders to find a solution to the Rhodesia problem
In the new Africa's political spectrum he was a moderate, dedicated to multiracialism, and always hoped for a peaceful evolution that would accommodate white Africans as well as black.
In contrast, he remained a staunch defender of the Zimbabwean President Robert Mugabe's policy of land reform, under which white farmers were driven from the country, resulting in economic meltdown.
"I've been saying it all along, please do not demonise Robert Mugabe. I'm not saying the methods he's using are correct, but he was put under great pressure."
The cracks began to appear in Kaunda's rule in late 1980. There were reports of an attempt to overthrow his government, and a dusk-to-dawn curfew was imposed over much of the country.
During the next 10 years, two further attempts to topple him were reported. The last of these, in the summer of 1990, followed food riots in the capital, Lusaka, and the Copperbelt region, over the government's crash austerity programme.
More than 20 people died in three days of rioting, and the security forces stormed the campus of Zambia University and closed it down to stifle unrest.
image copyrightAFPimage captionBy the time he travelled to Cuba in 1989 his grip on power was slipping
Kaunda was coming under increasing pressure both from inside Zambia and from the wider world to introduce real democracy. Eventually he agreed and called elections on 31 October 1991.
From the moment that campaigning began, it was clear that he was in trouble, and there was little surprise when the voters rejected him in favour of the Movement for Multi-Party Democracy, led by Frederick Chiluba.
But he still had great influence in Zambia and the new government perceived him as a threat.
Kaunda was arrested on charges of treason in 1997, although the new government was forced to back down after international pressure.
A later attempt to have him declared stateless was eventually thrown out by the courts.
image copyrightAlamyimage captionHe was a close ally of the late Zimbabwean leader Robert Mugabe
He turned his attention to the fight against HIV and Aids and was the first African leader to publicly admit that one of his sons, Masuzyo, had died of an Aids-related disease.
A prolific writer, he published a number of books advancing his ideology of African Socialism, which was picked up by other African leaders including Kwame Nkrumah in Ghana and Julius Nyerere in Tanzania.
Away from politics Kaunda was a keen ballroom dancer and, in 2011, was spotted as an enthusiastic audience member at a performance of Dancing with the Stars, the international version of Strictly Come Dancing.
He also played an accomplished guitar player and composed liberation songs which he played as he travelled the country to drum up support for the campaign against colonial rule.
In the main Kenneth Kaunda avoided much of the strife that was seen in other newly independent African nations and succeeded in uniting the disparate parts of his country under his slogan One Zambia, One Nation.
But his economic policies turned a country that had huge earnings potential into a state in which poverty remained widespread and life expectancy was among the lowest in the world.