Zimbabwe’s President Robert Mugabe has resigned, parliament speaker Jacob Mudenda has said.
A letter from Mr Mugabe said that the decision was voluntary and that he had made it to allow a smooth transition of power.
The surprise announcement halted an impeachment hearing that had begun against him.
Lawmakers roared in jubilation and people have begun celebrating in the streets.
Mr Mugabe, 93, was until now the world’s oldest leader. He had previously refused to resign despite last week’s military takeover and days of protests.
The letter did not mention who would take over from Mr Mugabe, who has been in power since independence in 1980.
The constitution says it should be the current vice-president, Phelekezela Mphoko, a supporter of Grace Mugabe, Mr Mugabe’s wife.
Mr Mudenda said moves were under way to ensure a new leader could take over by late on Wednesday.
UK Prime Minister Theresa May said Mr Mugabe’s resignation “provides Zimbabwe with an opportunity to forge a new path free of the oppression that characterised his rule”.
She said that former colonial power Britain, “as Zimbabwe’s oldest friend”, will do all it can to support free and fair elections and the rebuilding of the Zimbabwean economy.
Opposition leader Morgan Tsvangirai said he hoped that Zimbabwe was on a “new trajectory” that would include free and fair elections. He said Mr Mugabe should be allowed to “go and rest for his last days”.
In other reaction: The US Embassy in Harare, the capital, said it was a “historic moment” and congratulated Zimbabweans who “raised their voices and stated peacefully and clearly that the time for change was overdue”
South Africa’s main opposition Democratic Alliance welcomed the move, saying Mr Mugabe had turned from “liberator to dictator”
Prominent Zimbabwean opposition politician David Coltart tweeted: “We have removed a tyrant but not yet a tyranny”
Robert Mugabe won elections during his 37 years in power, but over the past 15 years these were marred by violence against political opponents.
He presided over a deepening economic crisis in Zimbabwe, where people are on average 15% poorer now than they were in 1980.
However, Mr Mugabe was not forced out after decades in power by a popular mass movement but rather as a result of political splits within his Zanu-PF party.
His dismissal of Emmerson Mnangagwa as vice-president two weeks ago was seen by many as clearing the way for Grace Mugabe to succeed her husband as leader.
It riled the military leadership, who stepped in and put Mr Mugabe under house arrest
The leader of the influential liberation war veterans – former allies of Mr Mugabe – said after the army takeover that Mr Mugabe was a “dictator”, who “as he became old, surrendered his court to a gang of thieves around his wife”.
Yet despite huge demonstrations in the streets celebrating what seemed like his impending demise, Robert Mugabe had until now refused to step down.