Namibia's President Hage Geingob, 82, died at Lady Pohamba Hospital in Windhoek, where he was receiving treatment, early on Sunday, the presidency said, weeks after he was diagnosed with cancer.
Geingob had been in charge of the thinly populated and mostly arid southern African country since 2015, the year he announced he had survived prostate cancer.
Vice President Nangolo Mbumba takes the helm in Namibia - a mining hotspot with significant deposits of diamonds and the electric car battery ingredient lithium - until presidential and parliamentary elections at the end of the year.
A presidency post on social media platform X did not give a cause of death, but late last month the presidency said he had travelled to the United States for "a two-day novel treatment for cancerous cells", after being diagnosed following a regular medical check-up.
Born in 1941, Geingob was a prominent politician since before Namibia achieved independence from South Africa in 1990.
He chaired the body that drafted Namibia's constitution, then became its first prime minister at independence on March 21 of that year, a position he retained until 2002.
'CHAINS OF INJUSTICE'
In 2007, Geingob became vice president of the governing South West Africa People's Organisation (SWAPO), which he had joined as an agitator for independence when Namibia was still known as South West Africa.
SWAPO has remained in power in Namibia unchallenged since independence. The former German colony is technically an upper middle-income country but one with huge disparities in wealth.
"There were no textbooks to prepare us for accomplishing the task of development and shared prosperity after independence," he said in a speech to mark the day in 2018. "We needed to build a Namibia in which the chains of the injustices of the past would be broken."
Geingob served as trade and industry minister before becoming prime minister again in 2012.
He won the 2014 election with 87 per cent of the vote but only narrowly avoided a runoff with a little more than half the votes in a subsequent poll in November 2019.

Shooting at Australia's Bondi Beach kills 12
Police hold person of interest after Brown University shooting leaves two dead
Hamas says Israel's killing of senior commander threatens ceasefire
Ukraine's Zelenskyy ditches NATO ambition ahead of peace talks
Thailand declares curfew along coast as Cambodia border fighting spreads
India tightens pollution curbs as Delhi's air quality worsens
'Peace is not far away' says Erdogan after Putin meeting
Belarus frees Nobel winner, protest figures as US lifts more sanctions
