HARARE, Zimbabwe – Robert Mugabe, Zimbabwe’s leader for nearly four decades, resigned on Tuesday after being sidelined by the military, according to the speaker of Parliament. The announcement marked the end of a tumultuous reign that went from the country’s independence through economic collapse.

The capital erupted in cheers, with crowds pouring into the streets, motorists honking horns and citizens giving high-fives to soldiers.

Mugabe’s exit marks a historic moment that will echo across Africa, where he was among the last surviving heroes of the anti-colonial struggle to remain in power, a leader who went from being lionized to being criticized as autocratic and brutal.

“For our generation we have never seen any change. We were not allowed to exercise our rights,” he added. Like many Zimbabweans, who has known no other leader.

“I am so happy the dictator is gone. I can’t speak, I have no words. We are finally free!” exclaimed Shoes Tazviwan, 36, a chef who had laso joined the demonstrations.

In the end, the world’s oldest head of state was a victim of his own allies. After years of purging members of his inner circle, Mugabe had alienated the leaders of Zimbabwe’s military, who detained him and seized control of the country’s government.

The announcement came a week after the military announced it had essentially assumed control of the country and detained the 93-year-old president. After days of negotiations – and the largest anti-government demonstration in the country’s history – Mugabe went quietly, sending his resignation letter to Parliament, where it was read by the speaker, Jacob Mudenda.

Mugabe resignation leaves Zimbabwe at a crossroads – with the military technically in charge of the country, but with a wide array of political groups now angling for power. Former vice-president Emmerson Mnangagwa, who was fired by Mugabe earlier this month, appears most likely to inherit the presidency, at least in the short term.

Mnangagwa is a longtime Mugabe ally, nicknamed “the Crocodile” for his reputation for shrewd but often brutal tactics. The State Department once said he was “widely feared and despised throughout the country” and “could be an even more repressive leader” than Mugabe.

For the moment, Mnangagwa has the backing of both opposition parties and activists, giving him a rare opportunity to build a transitional government made up of those united by a hatred of Mugabe.

“Let’s agree for this moment that the enemy of my enemy is my friend,” said Fadzayi Mahere, a lawyer and politician.

Mugabe’s life traced the historic changes that swept through southern Africa in the 20th and 21st centuries. He was born the son of a carpenter in the British colony of Southern Rhodesia and rose to lead the fight against Rhodesia’s white-minority government, which unilaterally declared independence from Britain.

When he came to power in 1980, Mugabe was a self-identified Marxist-Leninist whose intellect and political flair brought him support from across the world. In 1983, then vice-president George H.W. Bush called him a “genuine statesman.” In 1994, he was knighted by Queen Elizabeth II.

But his government’s descent was swift and dramatic. In the early 1980s, he was accused of backing the murder of 20,000 people of the Ndebele tribe, whom he considered dissidents. In the 1990s, economic mismanagement brought hyperinflation to Zimbabwe, resulting in the printing of 100 trillion dollar notes.

Thousands march in Zimbabwe to demand Mugabe step down

In the early 2000s, in an effort to satisfy his political allies and reaffirm his anti-colonial bona fides, Mugabe presided or the violent seizure of farmland belonging to white Zimbabweans. Much of that land sat fallow after it was re-distributed. The country once called “the breadbasket” of southern African was forced to start importing food.

As Mugabe grew older and more frail – and as opposition to his presidency mounted – Zimbabweans began talking openly about how the reign of the “old man” might end. For years, rumors circulated that he was critically ill, but Mugabe always re-emerged, giving cogent, if meandering, speeches well into his 90s.

But he often trailed off into anti-colonial rants that made it seem like Britain was preparing to invade. “Zimbabwe will never again be a colony,” became his trademark rallying cry, which meant little to young Zimbabweans who found it increasingly difficult to find work. The unemployment rate soared to over 50 percent. More than 2 million Zimbabweans moved to South Africa in search of jobs.

Few analysts predicted that his presidency would end with a coup. But after Mugabe fired his vice president, Mnangagwa, paving the way for his controversial wife Grace to succeed him, Zimbabwe’s security forces revolted.

Since the army’s action a week ago, there has been no sign of Grace Mugabe, nicknamed “Gucci Grace” for her expensive shopping sprees that turned many Zimbabweans against the first family. In 2015, she purchased a $1.3 million diamond ring and then demanded a refund when she found it unsatisfactory. The average per capita GDP in Zimbabwe is $1,008.

More in Nation & World

SUNRISE, Fla. (AP) — Republican Sen. Marco Rubio was put on the defensive Wednesday by angry students, teachers and parents who are demanding stronger gun-control measures after the shooting rampage that claimed 17 lives at a Florida high school.

Our nation’s education secretary recently suggested that to prevent the next school massacre perhaps teachers should be permitted to carry guns. People took to social media to roar that many schools can’t even afford pencils, let alone armaments.