The African leader announced last month that he had started treatment for cancer.
Namibia's President Hage Geingob has died at the age of 82, less than three weeks after it was announced that he would undergo treatment for cancer, the presidential palace announced.
Acting President N'Golo Mbumba announced in a statement posted on Geingob's official Facebook page that Geingob died on Sunday at Lady Pohamba Hospital in the capital Windhoek, surrounded by his wife and children.
“The Namibian nation has lost a distinguished servant of its people, a symbol of the liberation struggle, the chief architect of its constitution and the breadwinner of the Namibian family,” Mbumba said.
“At this moment of deepest sadness, I appeal to the public to remain calm while the government takes note of all necessary national arrangements, preparations and other protocols. Further announcements will be made in this regard. It is scheduled to take place.”
Geingob's office announced last month that “cancer cells” were discovered during a routine colonoscopy and gastroscopy, and treatment had begun.
The announcement did not provide details of the African leader's diagnosis or prognosis, but said he would continue to carry out his presidential duties.
Geingob's office subsequently announced that he would travel to the United States for treatment and return to Namibia on February 2.
Geingob also served as prime minister for 12 years, but suffered from health problems before being elected as Namibia's third president in 2014.
The anti-apartheid activist turned politician underwent brain surgery in 2013 and revealed the following year that he had beaten prostate cancer.
Last year, Geingob announced that he had undergone surgery on his aorta in neighboring South Africa.
Namibia is a former German colony that gained independence from South Africa in 1990, and presidential and parliamentary elections are scheduled for November.
Geingob was not eligible to stand for re-election because Namibia's constitution limits presidential terms to a maximum of two terms.
If the ruling SWAPO party's presidential candidate, Nnamdi Ndutowa, wins, she will become the country's first female head of state.