Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

By Alastair Jamieson and The Associated Press

Robert Mugabe, the world’s oldest ruler, resigned as Zimbabwe’s president on Tuesday, signaling the final end of his decades in power after last week’s military coup.

The 93-year-old despot wrote a letter saying he was quitting "with immediate effect,” said Jacob Mudenda, speaker of the country’s Parliament.

Lawmakers erupted in cheers at the news, which came after days of uncertainty and chaos following the seizure of power by military chiefs.

Moments earlier, the Parliament had begun to impeach Mugabe, who has run the increasingly impoverished southern African nation since its independence and the end of minority white rule in 1980.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

He stunned Zimbabweans in a rambling live television address late Sunday night in which he surprised even his closest advisers by avoiding any mention of stepping down.

Robert Mugabe wanted to fight another election in 2018. Alexander Joe / AFP - Getty Images file

The country's ruling ZANU-PF party had already removed Mugabe as leader, naming Emmerson Mnangagwa in his place.

It was Mugabe's sacking of Mnangagwa as his vice president — paving the way for his wife, Grace, to succeed him — that triggered the army to seize control last Wednesday.

Lovemore Matuke, a ZANU-PF official, told The Associated Press that Mnangagwa, who fled the country after his firing, would take over within 48 hours.

Related: Mugabe makes post-coup appearance — but where's wife 'Gucci Grace'?

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

Members of Zimbabwe's parliament celebrate after Mugabe's resignation on Tuesday. Jekesai Njikizana / AFP - Getty Images

The statement said that "whatever short-term arrangements the government may establish, the path forward must lead to free, fair and inclusive elections." The United States also urges "unwavering respect for the rule of law."

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

Photos: Zimbabwe rejoices as Mugabe steps down

The British leader said the Zimbabwean people have shown they want "free and fair elections and the opportunity to rebuild the country's economy under a legitimate government." May said Britain — the former colonial power — is "Zimbabwe's oldest friend" and will "help the country achieve the brighter future it so deserves."