Zambia's founding president Kenneth Kaunda died on Thursday at the age of 97, the government announced, days after he was admitted to hospital with pneumonia.

The government declared 21 days of national mourning, ordered flags to fly at half mast and banned all entertainment in honour of the "icon and global statesman".

"You have gone at a time we least expected," President Edgar Lungu said on Facebook, describing Kaunda as a "true African icon."

Cabinet secretary Simon Miti said in an address on public television that Kaunda "died peacefully" at 2:30 pm (1230 GMT) at a military hospital where he had been receiving treatment since Monday.

Kaunda ruled Zambia for 27 years, taking the helm after the country gained independence from Britain in October 1964.

British Prime Minister Boris Johnson said in a tweet that he was "saddened to learn of the death of Kenneth Kaunda," sending his condolences to the people of Zambia.

Popularly known by his initials KK, Kaunda was head of the main nationalist party, the left-of-centre United National Independence Party (UNIP) that led the country after British colonial rule.

While in power he hosted many of the movements fighting for independence or black equality in other countries around the region, including South Africa's African National Congress (ANC).

Kenneth Kaunda "died peacefully" at a military hospital where he had been receiving treatment since Monday
Kenneth Kaunda "died peacefully" at a military hospital where he had been receiving treatment since Monday LEHTIKUVA / -

Kaunda was nicknamed by some "Africa's Gandhi" for his non-violent, independence-related activism in the 1960s.

But his popularity at home waned as he became increasingly autocratic and banned all opposition parties.

He eventually ceded power in the first multi-party elections in 1991, losing to trade unionist Fredrick Chiluba.

Despite the change over of power between different political parties since Kaunda left office, the landlocked southern African country has enjoyed relative stability.

In later life, Kaunda regained stature as an African statesman, helping to mediate crises in Zimbabwe and Kenya.

He also became an anti-AIDS activist after acknowledging that the disease had killed one of his own sons

Map of Zambia locating the capital Lusaka.
Map of Zambia locating the capital Lusaka. AFP / Jonathan WALTER

News of his death started filtering through social media and by the time government officially announced it, sombre Zambians had been anxiously glued to television screens in public places.

In a show of respect, the largest opposition party, the United Party for National Development (UPND), temporarily halted all election campaigning ahead of the August 12 vote.

"We urge all to remain peaceful and united as we continue to reflect on the life of... Kaunda, the immense sense of duty, service and sacrifice with which he led and served our country," the UPND said in a statement.

One of Kaunda's last major international public appearances was in December 2013 during Nelson Mandela's funeral. At the age of 89 even then, he jogged up to the podium to pay tribute.

"We will not forget Kaunda's contributions to the struggles against colonialism and apartheid," the Nelson Mandela Foundation said in a statement.

In neighbouring Botswana, President Mokgweetsi Masisi declared seven days of mourning in honour of the "charismatic" and "selfless" Kaunda, whom he described as an "iconic statesman of the highest credentials".

African Union Commission, Moussa Faki Mahamat said "he embodied the true sense of Pan-Africanism, placing his own country Zambia at grave risk... to provide safe harbour" for liberation movements.

The ANC described him as a "giant of the liberation struggle", while South Africa's ex-president Thabo Mbeki called him "a people's person".

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.

His middle name "Buchizya" means the unexpected child.

"This is really a dark day for Zambia," a 50-year-old Lusaka resident Herbert Simbeye, who attended the same church as Kaunda, told AFP.

"At his 90th birthday, my son was one of the people who gave KK flowers at church".

Kaunda had nine children with his wife Betty, who died in 2012.

He had great love for singing and dancing, and enjoyed playing the guitar and singing romantic tunes to his wife.

A 2019 video shared widely on social media, Kaunda was seen dancing away, a walking frame in one hand and his famous white handkerchief in another.