Namibia's President Hage Geingob, 82, died in hospital early on Sunday, the presidency said, weeks after he was diagnosed with cancer.
Geingob had been in charge of the southern African country since 2015, the year he announced he had survived prostate cancer.
Vice President Nangolo Mbumba takes the helm in Namibia until presidential and parliamentary elections at the end of the year.
A presidency post on social media platform X did not give the exact 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.
The Namibian presidency says the president died at a hospital in the capital, Windhoek.
Born in 1941, Geingob was a prominent politician since before Namibia achieved independence from white minority-ruled South Africa in 1990.
Geingob political journey
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.
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.
It is mining hotspot with significant deposits of diamonds and the electric car battery ingredient lithium.
Elections win
"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," Reuters news agency reports.
Geingob served as trade and industry minister before becoming prime minister again in 2012.
He won the 2014 election with 87% of the vote but only narrowly avoided a runoff with a little more than half the votes in a subsequent poll in November 2019.
➤Click here to follow our WhatsApp channel for more stories.