WINDHOEK, Namibia (AP) — Namibia’s president and founding prime minister Hage Geingob died Sunday at age 82 while receiving treatment for cancer, and the southern African nation quickly swore in his deputy to complete the term in office.

Geingob played a central role in what has become one of Africa’s most stable democracies after returning from a long exile in Botswana and the United States as an anti-apartheid activist. He was the country’s third president since it gained independence in 1990 following more than a century of German and then apartheid South African rule.

He had been president since 2015 and was set to finish his second and final term this year. His deputy, Vice President Nangolo Mbumba, was sworn in as acting president in the capital, Windhoek, to complete the term as allowed by the constitution.

Elections are set for November. A government statement said Mbumba will lead Namibia until Mar. 21 of next year, when the winner takes office.