(CNN) Zimbabwe's former president Robert Mugabe , who was once feted as an independence hero but whose 37-year rule left his country deeply divided and nearly broke, has died at the age of 95.

To his loyal supporters, he remained until his death the revered leader who ushered in independence after bringing an end to white-minority rule. But to his critics, Mugabe was the caricature of an African dictator who oppressed his opponents and ruined a country to retain power, which he was forced to relinquish, at the age of 93, in 2017.

Rumors had swirled around the health of the ex-president, who spent months in a hospital in Singapore earlier this year. Details of what ailed him were a closely guarded secret.

Mugabe -- who infamously claimed that "only God" could ever remove him from office -- was deposed in a coup in 2017 , when members of his own party turned against him after he dismissed his longtime ally, then-vice president Emmerson Mnangagwa, to make way for his much younger wife Grace.

Fearing an erosion of their influence, senior security forces officials ousted him, replacing him with Mnangagwa.

"It is with the utmost sadness that I announce the passing on of Zimbabwe's founding father and former President, Cde Robert Mugabe," tweeted President Mnangagwa 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."

A former teacher, Mugabe was imprisoned for ten years for opposing the white-minority government of Rhodesia (as Zimbabwe was known before independence). After his release, he orchestrated a guerilla war which won freedom for his country in 1980. As Zimbabwe's first prime minister, he was at first lauded internationally for building schools and hospitals.

However, the former champion of one man, one vote soon mounted a brutal crackdown against the opposition led by the late nationalist politician Joshua Nkomo. For decades, he maintained his grip on the country with the support of the army and a series of controversial elections.

His rule was marked by the violent eviction of thousands of white farmers in 2000, and increasingly dubious elections, including one in 2008 which he lost to Morgan Tsvangirai, sparking political violence that human rights groups say claimed over 200 lives.

Widely seen as a disgraced aging despot desperately clinging to power, Mugabe's rule finally came to an end at the hands of the regime he had spent decades building.

Photos: The life and career of Robert Mugabe Robert Mugabe is sworn in for his seventh term as Zimbabwe's President in August 2013. He resigned in November 2017 after nearly four decades in power. Hide Caption 1 of 31 Photos: The life and career of Robert Mugabe Mugabe gestures towards the media in Geneva, Switzerland, at a 1974 conference convened to address the civil war in Rhodesia. After being imprisoned for 10 years in Rhodesia, Mugabe attended the peace talks as a leader of the guerrilla movement ZANU-PF (Zimbabwe African National Union-Patriotic Front). Rhodesia was the state that eventually became Zimbabwe. Hide Caption 2 of 31 Photos: The life and career of Robert Mugabe Mugabe speaks to the press in Geneva in 1976. The following year he was elected president of ZANU-PF and commander-in-chief of the Zimbabwe African National Liberation Army. Hide Caption 3 of 31 Photos: The life and career of Robert Mugabe Mugabe holds a news conference in Salisbury -- now Harare, the capital of Zimbabwe -- in March 1980. He had just been elected as the first prime minister of Zimbabwe, helping to form the new country after British rule of Rhodesia came to an end. Hide Caption 4 of 31 Photos: The life and career of Robert Mugabe From left, NBC News moderator Bill Monroe, Newsday's Les Payne, the Chicago Sun Times' Robert Novak and NBC News' Garrick Utley speak with Mugabe during an episode of "Meet the Press" in 1980. Hide Caption 5 of 31 Photos: The life and career of Robert Mugabe Mugabe holds hands with Libyan leader Moammar Gadhafi at the Organization of African Unity summit in August 1982. Hide Caption 6 of 31 Photos: The life and career of Robert Mugabe Mugabe speaks with his first wife, Sally, during an event in Salisbury in 1980. The pair were married until Sally died in 1992. They had one son, who died at age 4. Hide Caption 7 of 31 Photos: The life and career of Robert Mugabe Mugabe meets with French President Francois Mitterand in Paris in 1982. Hide Caption 8 of 31 Photos: The life and career of Robert Mugabe Mugabe is seen with Indian Prime Minister Indira Gandhi in New Delhi in 1983. Hide Caption 9 of 31 Photos: The life and career of Robert Mugabe Mugabe walks hand in hand with American civil rights activist Jesse Jackson during the Summit of Non-Aligned Countries, which Harare hosted in 1986. Hide Caption 10 of 31 Photos: The life and career of Robert Mugabe Mugabe delivers a speech in Harare in August 1986. Hide Caption 11 of 31 Photos: The life and career of Robert Mugabe Mugabe poses for a photo with other leaders at a Commonwealth of Nations meeting in London in 1986. Pictured from left, in the back row, are Indian Prime Minister Rajiv Gandhi, Canadian Prime Minister Brian Mulroney, Commonwealth Secretary-General S.S. Ramphal, Australian Prime Minister Robert Hawke and Mugabe. In the front row, from left, are British Prime Minister Margaret Thatcher, Bahamian Prime Minister Lynden Pindling and Zambian President Kenneth Kaunda. Hide Caption 12 of 31 Photos: The life and career of Robert Mugabe Britain's Queen Elizabeth II toasts Mugabe during a banquet in the Queen's honor in Harare in October 1991. The Queen had last visited the territory that became Zimbabwe in 1947. Hide Caption 13 of 31 Photos: The life and career of Robert Mugabe US President Bill Clinton gestures while talking to Mugabe after a White House meeting in Washington in May 1995. Hide Caption 14 of 31 Photos: The life and career of Robert Mugabe Mugabe marries Grace Marufu on August 17, 1996. Earlier in the year, he was re-elected President after all of his opponents dropped out of the race. Hide Caption 15 of 31 Photos: The life and career of Robert Mugabe British Prime Minister Tony Blair talks with Mugabe in October 1997, before the start of the Commonwealth Heads of Government meeting. Hide Caption 16 of 31 Photos: The life and career of Robert Mugabe Mugabe speaks during the Southern Africa trade and investment summit in Windhoek, Namibia, in October 2000. Earlier in the year, he implemented a controversial land-reform program that saw the seizure of land from some 4,000 white farmers. Hide Caption 17 of 31 Photos: The life and career of Robert Mugabe Mugabe and Cuban President Fidel Castro are seen in Havana, Cuba, in September 2005. Hide Caption 18 of 31 Photos: The life and career of Robert Mugabe South African President Jacob Zuma walks with Mugabe at Harare International Airport in March 2010. Hide Caption 19 of 31 Photos: The life and career of Robert Mugabe Mugabe addresses the 65th session of the United Nations General Assembly in September 2010. Hide Caption 20 of 31 Photos: The life and career of Robert Mugabe Mugabe cuts his birthday cake with his wife, Grace, and son Bellarmine Chatunga during celebrations in Harare in February 2011. Mugabe was turning 87. Hide Caption 21 of 31 Photos: The life and career of Robert Mugabe Robert and Grace Mugabe arrive at the Vatican for the beatification ceremony of John Paul II in May 2011. Hide Caption 22 of 31 Photos: The life and career of Robert Mugabe Mugabe delivers a speech at his party's annual national conference in December 2012. He vowed to overhaul business laws to require 100% black ownership of firms. Hide Caption 23 of 31 Photos: The life and career of Robert Mugabe The Mugabes attend Pope Francis' inauguration Mass in March 2013. Hide Caption 24 of 31 Photos: The life and career of Robert Mugabe Mugabe and Chinese President Xi Jinping participate in a signing ceremony in Beijing in 2014. Hide Caption 25 of 31 Photos: The life and career of Robert Mugabe Mugabe speaks at the ZANU-PF party's annual conference in December 2016. The party endorsed Mugabe as its candidate for the 2018 election. Hide Caption 26 of 31 Photos: The life and career of Robert Mugabe Mugabe reviews the guard of honor during Zimbabwe's 37th Independence Day celebrations in April 2017. Hide Caption 27 of 31 Photos: The life and career of Robert Mugabe Mugabe kisses his wife during Independence Day celebrations in April 2017. In early November, the sacking of Mugabe's longtime ally and vice president, Emmerson Mnangagwa, was seen as a move to potentially clear the way for Grace Mugabe to succeed her 93-year-old husband. Hide Caption 28 of 31 Photos: The life and career of Robert Mugabe Mugabe arrives to preside over a student graduation ceremony at Zimbabwe Open University in November 2017. It was his first public appearance since the military seized control of the nation and placed him under house arrest. Hide Caption 29 of 31 Photos: The life and career of Robert Mugabe Mugabe meets with generals in Harare in November 2017. Military leaders had been in talks with Mugabe over his exit. Hide Caption 30 of 31 Photos: The life and career of Robert Mugabe Mugabe casts his vote in the 2018 Zimbabwe elections. Hide Caption 31 of 31

The son of a carpenter and a teacher

Robert Gabriel Mugabe was born on February 21, 1924, at the Roman Catholic Kutama Mission, Southern Rhodesia. His father, Gabriel Mugabe, was a carpenter and his mother, Bona, a catechism teacher.

After elementary school he entered a teacher training college, going on to work in several schools in Rhodesia before winning a scholarship to the University of Fort Hare in South Africa, where he studied history and English.

In 1952, after graduating, he returned to teach in Rhodesia, later moving to Northern Rhodesia (now Zambia) and Ghana, a period during which he accumulated more university degrees, and met his first wife, Sally Hayfron.

In 1960, he returned to Rhodesia and worked as publicity secretary for the newly founded anti-colonialist, African nationalist National Democratic Party. Quickly rising in influence, he advocated violence to end white rule, co-founding the Zimbabwe African National Union (ZANU) with Ndabaningi Sithole in Tanzania after fleeing Rhodesia.

He and his comrades insisted the white leadership was illegitimate, had occupied his people's land and made them "a race of no rights beyond those of chattel."

In 1963, he returned and was arrested for making subversive statements. He spent almost eleven years in jail, during which time he continued his political activism and study, earning university degrees in education, economics, administration and law.

After his release in 1974, he led the ZANU-PF, the guerilla movement, from Mozambique against Premier Ian Smith's white minority rule.

When the war ended in 1979, Mugabe was hailed as a war hero at home and abroad.

He went on to lead the newly independent Zimbabwe -- as prime minister from 1980 to 1987, when he became its president.

Articulate and smartly dressed, Mugabe came to power commanding the respect of a nation. He had a strong head start, inheriting a country with a stable economy, solid infrastructure and vast natural resources.

But the descent into tyranny didn't take long.

His hardline policies drove the country's flourishing economy to disintegrate after a program of land seizures from white farmers, and agricultural output plummeted and inflation soared.

At first, Mugabe preached reconciliation with former enemies at home and abroad. For the country's black majority, Mugabe built schools and hospitals and promoted agriculture for peasant farmers.

He was lauded by the West as a new kind of African liberation leader, particularly by former colonial ruler Britain, which had refused to recognize Smith's government and leveled economic sanctions against the country.

'A degree in violence'

But early on in his rule, Mugabe showed a penchant for dealing with opponents ruthlessly. The most startling example was the Gukurahundi killings between 1983 and 1987.

Mugabe was accused of leading the massacre against political opponents. Tens of thousands of ethnic Ndebeles were killed -- including many found in mass graves that the victims reportedly had to dig themselves.

His reputation for ruthlessness stemmed from this period. Later Mugabe would boast of having a "degree in violence".

Despite the turmoil, Zimbabwe's economy was strong in the early years of Mugabe's rule. The country was known as the "breadbasket" of southern Africa and showed startling improvements in literacy rates.

But the tone began to change in 1987 when Mugabe consolidated his power, assuming the office of president and head of the armed forces. In the early 1990s, the government began to amend laws allowing it to purchase land for resettlement and redistribution, prompting objections from landowners and the US and UK.

As land-grabs escalated, the economy began a downward spiral in 1995 that culminated in catastrophic hyperinflation. Mugabe's government faced charges of elitism, cronyism and corruption.

In 1996, he married his former secretary, Grace Marufu (following the death of his first wife in 1992). Elections that year became a one-man contest, after all other opponents dropped out days before the poll.

President Robert Mugabe and his wife Grace pictured at their wedding ceremony on August 17 1996.

In 2000, Mugabe and his ruling ZANU-PF party suffered their first major defeat since coming to power. Voters rejected a new constitution, handing the longtime president an unexpected blow in what was widely considered a confidence vote on his government.

The rejection emboldened the newly formed opposition party, Movement for Democratic Change (MDC), but it also prompted Mugabe to take drastic measures to stay in power.

As the economy continued to worsen, Mugabe gave his blessing to roving bands of so-called war veterans to embark on often violent seizures of hundreds of white-owned farms they claimed had been stolen by settlers.

Mugabe called the land battle "The Third Chimurenga," deliberately linking the farm seizure program to Zimbabwe's struggle against colonial rule.

Many of the farms were turned over to Mugabe's cronies, who subsequently did not harvest the land, further contributing to Zimbabwe's economic collapse. International aid and foreign investment dried up in the wake of the land-seizure program, and the US and European Union imposed economic sanctions on the country.

In the following years, his government charged the MDC's leader Tsvangirai with treason and passed increasingly tough laws aimed at stifling the independent media and public dissent.

In 2007, the University of Edinburgh withdrew the honorary degree it awarded Mugabe in 1984 for his services to education in Africa. In 2008, the UK stripped him of his 1994 knighthood and the University of Massachusetts Board of Trustees revoked the honorary law degree it gave to Mugabe in 1986.

But at elections marred by deadly violence and accusations of vote rigging in 2008, Mugabe was forced to concede some of his power. The MDC won a majority of seats in the parliamentary vote, claiming also that Tsvangirai had secured more than 50% of the presidential votes as well.

Mugabe claimed victory, but he was forced to hold talks to resolve the ongoing political dispute. Tsvangirai accepted the post of prime minister in a power-sharing deal negotiated by South Africa -- though claims of ZANU-PF harassment and violence against opposition politicians persist to the present.

Despite Zimbabwe's deepening economic crisis, Mugabe continually rebuffed calls to step down, insisting he would leave office only when his "revolution" was complete. That, he said, meant until the end of his days on earth: "Only God who appointed me will remove me -- not the MDC, not the British."

He focused his ire on the economic sanctions imposed by the United States and the European Union, which he said were "unjustified" and "illegal" and intended to bring about regime change.

In 2010, he was nominated by his party to run for the presidency again. However, the 86-year old was reportedly making regular trips to Singapore for medical treatment.

Despite this, Mugabe, appearing as politically strong as ever, was re-elected with a solid majority in 2013, ending the power-sharing agreement signed in 2008. Tsvangirai alleged widespread fraud.

However, in 2014 signs of dissent emerged among his loyalists. Mugabe fired his deputy Joice Mujuru, a few hours after she dismissed allegations that she'd plotted to assassinate Mugabe as "ridiculous". Zimbabwe's Chief Secretary to the Cabinet Misheck Sibanda said that Mugabe also fired eight Cabinet ministers.

'He focused on himself'

On November 7, 2017, Mugabe finally came unstuck when he fired Mnangagwa in a move to clear the way for his ambitious wife.

A week later, Zimbabwe's military leaders seized control, placing Mugabe under house arrest and deploying armored vehicles to the streets of the capital, Harare.

On November 21, 2017, Mugabe resigned as Zimbabwe's president after 37 years of autocratic rule.

In his "retirement," Mugabe was rarely seen in public, instead spending his time between Singapore, where he received medical treatment, and his plush 25-room Blue House residence in Harare.

Sightings of his wife, nicknamed "Gucci Grace" for her love of designer goods, became similarly scarce. The couple were criticized for their luxury lifestyles as the country was plunged into economic ruin

He celebrated his 85th birthday with an opulent party that cost a reported $250,000 and continued to hold such birthday events annually, last year spending a reported $800,000 and celebrating in a region suffering drought and food shortages.

He repeatedly rebuffed repeated calls to step down, insisting he would only leave office when his "revolution" was complete.

"This is a man who had so much to offer to Zimbabweans, but he didn't, he focused on himself," said Trevor Ncube, one of the country's most powerful publishers.