Robert Mugabe, the cartoonish dictator of Zimbabwe, wasn’t corrupted by 37 years in power. Contrary to the myth his admirers created in the 1980s, he never was a selfless revolutionary devoted to the welfare of his people.

From his political emergence in the 1960s to his ousting in a coup this week, Mugabe remained what he always was: a hard-core Marxist willing to do anything to gain and hold onto absolute power.

His time in office was marked by violence and economic illiteracy — a fatal combination that broke the once-prosperous country. As befits the fate of a tyrant, Mugabe finally found himself at the mercy of his erstwhile henchmen. And as he exits the political arena, he leaves Zimbabwe in the hands of a man who is, arguably, even more brutal than Mugabe himself.

Mugabe, a carpenter’s son born in 1924 in Southern Rhodesia’s Kutama Mission, was inculcated with a deep hatred of the British Empire by an Irish Jesuit who ran a mission. Bookish and intelligent, Mugabe won a scholarship to study at a South African university, where he got his first taste of Marxism.

In 1960, he joined Joshua Nkomo’s Zimbabwe African People’s Union, a black liberation movement committed to ending colonial rule in Rhodesia.

After falling out with Nkomo, Mugabe helped to establish the Zimbabwe African National Union. The two movements — ZAPU, supported by the Soviets, and ZANU, backed by the Red Chinese — were soon at loggerheads and, following an outbreak of violence, both Nkomo and Mugabe were imprisoned by the Rhodesian authorities.

Upon his release in 1974, Mugabe left the country for safe haven in Mozambique from where ZANU launched a guerrilla war against his former captors. Unsuited for combat, Mugabe outsourced the actual fighting to one of his deputies, Josiah Tongogara. The mounting costs of war, international pressure and economic sanctions forced the Rhodesian government to the negotiating table and set the country on a path to the fateful 1980 election.

Preparing for the election, Mugabe appeared to have disposed of Tongogara, a possible rival, in what the US Embassy in Lusaka described as a “non-accidental” car crash. Mugabe’s guerrillas also intimidated defenseless villagers into casting their votes for ZANU. Much to everyone’s surprise, Mugabe won 57 out of the 100 seats in Parliament.

In the early 1980s, Mugabe’s North Korea-trained troops descended on Nkomo’s stronghold in the Matabeleland, killing 20,000 people and forcing Nkomo into exile. The man entrusted with the grisly task of genocide, Emmerson Mnangagwa, would become Mugabe’s right-hand man — for a time.

During the 1980s, government corruption metastasized while Mugabe’s socialist policies slowly suffocated the country’s economy. Burgeoning debt and deficits necessitated an IMF bailout and a promise of economic reforms in the 1990s.

As socialism collapsed in Europe, the aging revolutionary reinvented himself as the enemy of all things Western and determined to wipe out the last vestiges of the British colonial legacy in Zimbabwe. These were the white farmers, who constituted the backbone of Zimbabwe’s economy.

Using the pretext of the farmers’ meddling in politics, Mugabe started expropriating commercial farmland in 2000, which occasioned a spectacular economic meltdown.

In 2008, the country’s output fell to the 1979 level and GDP per capita to levels last seen in the 1950s. Zimbabwe saw the second-highest hyperinflation in recorded history, an annualized rate of 90 sextillion percent. Unemployment rocketed to 90 percent and government departments — with the expectation of the military and police — effectively ceased to function. Yet Mugabe, propped up by South Africa’s President Thabo Mbeki, survived and limped along with Zimbabwe for another decade.

Now, aged 94, the increasingly fragile and senile Mugabe made a grave error by dismissing his vice president to clear the way for his second wife, the 52-year-old Grace, to ascend to the presidency. Mnangagwa responded by apparently staging a coup and placing Mugabe under house arrest.

Latest reports suggest that Mugabe will be permitted to go into exile unmolested, leaving a broken country at the mercy of a murderous maniac. If so, Zimbabwe is a long way from gaining political freedom or returning to economic growth. The international community will doubtless try to keep up pressure on ZANU and its new leadership, but, in the end, it’s up to Zimbabweans to avoid another Mugabe.

This piece first appeared in the New York Post.