Robert Mugabe, the former president of Zimbabwe who became an African liberation hero after toppling white colonial rule but then led his country to economic collapse and the brink of starvation, has died at the age of 95.

"It is with the utmost sadness that I announce the passing on of Zimbabwe's founding father and former president, Cde Robert Mugabe," President Emmerson Dambudzo Mnangagwa, who was elected after Mugabe stepped down, tweeted on Friday.

Cde Mugabe was an icon of liberation, a pan-Africanist who dedicated his life to the emancipation and empowerment of his people. His contribution to the history of our nation and continent will never be forgotten. May his soul rest in eternal peace (2/2) — President of Zimbabwe (@edmnangagwa) September 6, 2019

Mugabe was the world's oldest ruler when he resigned as Zimbabwe's president in November of 2017, following a military coup. He had ruled the country since 1980.

Mugabe's family also confirmed his death to the BBC. He had been receiving medical treatment in Singapore.

Download the NBC News app for breaking news

The teacher-turned-independence fighter leaves behind a checkered legacy.

Before he resigned, the ruling Zimbabwe African National Union-Patriotic Front party had already removed Mugabe as leader and named Mnangagwa in his place.

But his successor Mnangagwa said that Mugabe was "an icon of liberation" and "a pan-Africanist who dedicated his life to the emancipation and empowerment of his people."

"His contribution to the history of our nation and continent will never be forgotten. May his soul rest in eternal peace,” Mnangagwa tweeted.

Fadzayi Mahere, a politician with the opposition Movement for Democratic Change, tweeted "rest in peace" and "My response to your passing is complicated ... However, for now, deepest condolences to his family."

Before he resigned, it was said that Mugabe’s firing of Mnangagwa as his vice president, which would have paved the way for Mugabe’s wife, Grace, to succeed him, triggered the army to seize control.

The U.S. Embassy in Zimbabwe said at the time that the resignation of Mugabe "marks an historic moment" for the country and congratulated all Zimbabweans who raised their voices.

Then-British Prime Minister Theresa May said the resignation of Mugabe gave Zimbabwe "an opportunity to forge a new path free of the oppression that characterized his rule."

He became prime minister after the end of white minority rule in 1980 in the country, which was previously known as Rhodesia. He took office as president in 1987 following a change in the constitution.

The liberation hero cast himself champion of racial reconciliation when he first came to power, but nearly four decades later critics denounced him as an autocrat willing to unleash death squads, rig elections and trash the economy.

Mugabe pushed legislation through Parliament allowing his government to seize more than half the white-owned farms, and his crackdown against the Movement for Democratic Change and journalists in the early 2000s increased his international isolation.

Land reform was supposed to take much of the country's most fertile land — owned by about 4,500 white descendants of mainly British and South African colonial-era settlers — and redistribute it to poor blacks. Instead, Mugabe gave prime farms to ruling party leaders, party loyalists, security chiefs, relatives and cronies.

The economy of Zimbabwe, an African nation of more than 14 million north of South Africa and bordered by Botswana, Mozambique and Zambia, collapsed under Mugabe after 37 years of near one-party rule.

Regional leaders showered Mugabe with praise for his role in throwing off colonial rule.

The African National Congress, the political party of anti-apartheid hero Nelson Mandela, mourned Mugabe’s death and said he had “devoted his life to the service of his country and his people.” Mugabe supported the party's fight against white rule during its years of exile and beyond.

"Though the ANC and its leadership may have differed, often vociferously, with Comrade Mugabe on matters of national interest — as fraternal organizations we held as sacrosanct the principle of sovereignty," the ANC said in a tweeted statement.

Robert Mugabe raises his fists in salute to a group of supporters as he arrives at Lusaka Airport, Zambia, in January 1977. AP file

"Words cannot convey the magnitude of the loss as former President Mugabe was an elder statesman, a freedom fighter and a Pan-Africanist who played a major role in shaping the interests of the African continent," said Kenya's President Uhuru Kenyatta.

On the streets of capital Harare, universal praise was harder to come by.

"I will not shed a tear, not for that cruel man," Tariro Makena, a street vendor, told the Associated Press. "All these problems, he started them and people now want us to pretend it never happened."

Despite Mugabe's departure, Zimbabwe's economy remains in its worst economic crisis in a decade. Inflation is in the triple digits, and rolling power cuts and shortages of U.S. dollars and basic goods have raised fears that the hyperinflation that forced it to ditch its currency in 2009 was set to return.

Silas Marongo, who was holding an axe and joining men and women cutting a tree for firewood in suburban Harare to beat severe electricity shortages, told the AP that he missed Mugabe.

Recyclers are seen scouring Richmond sanitary landfill site for material in Zimbabwe. Zinyange Auntony / AFP - Getty Images

"Things are worse now. Life was not that good but it was never this bad. These people who removed him from power have no clue whatsoever," Marongo told the AP.

Henning Melber, a senior research associate at the Nordic Africa Institute in Sweden and an expert in liberation movements in southern Africa, said that the statements mourning Mugabe as a revolutionary figure should not obscure his history of repression.

"Mugabe was an autocrat," Melber said. "I think there is a long track record of Mugabe of violence, which was originally against a white minority terrorist rule but which turned into violence against his own people," he said.

Zimbabwe is a failed state at the moment, Melber said.

"There are millions of Zimbabweans living in the U.K., Botswana, South Africa — all over the world — who have no chance of return because they will not be able to make a living there," he added.

Mugabe's last five-year term began in 2013 after elections criticized by international monitors. Mugabe responded by telling his critics to "go hang."

Mugabe told NBC News in 2013 that “we have never, ever rigged an election.”

He blamed Britain for the country’s problems, and said at that time that he had no second thought about his time leading the country.

"I don't have regrets at all," he said.