Robert Mugabe agreed on Sunday to resign as Zimbabwe's president hours after the ruling ZANU-PF party fired him as its leader following 37 years in charge, a source familiar with the negotiations said.
ZANU-PF had given the 93-year-old less than 24 hours to quit as head of state or face impeachment, an attempt to secure a peaceful end to his tenure after a de facto coup.
The source said the Zimbabwe military was working on a resignation statement by Mugabe, without giving details.
Zimbabwe's state broadcaster ZBC said Mugabe would address the nation shortly. Earlier on Sunday, the official Herald newspaper showed pictures of him meeting top generals at his State House offices.
Mugabe, the only leader the southern African nation has known since independence from Britain in 1980, was replaced by Emmerson Mnangagwa, the deputy he sacked this month in a move that triggered the mid-week intervention by the army.
In scenes unthinkable just a week ago, the announcement drew cheers from the 200 delegates packed into ZANU-PF's Harare headquarters to seal the fate of Mugabe, whose support has crumbled in the four days since the army seized power.
Mugabe was given until noon (5.00 a.m. ET) on Monday to resign or face impeachment, an ignominious end to the career of the "Grand Old Man" of African politics who was once feted across the continent as an anti-colonial liberation hero.
Even in the West, he was renowned in his early years as the "Thinking Man's Guerrilla", an ironic nickname for a man who would later proudly declare he held a "degree in violence".
As the economy crumbled and political opposition to his rule grew in the late 1990s, Mugabe seized thousands of white-owned farms, detained opponents and unleashed security forces to crush dissent.
When the vote was announced, war veterans leader Chris Mutsvangwa, who has spearheaded an 18-month campaign to remove a man he openly described as a "dictator", embraced colleagues and shouted: "The President is gone. Long live the new President."
Mugabe's 52-year-old wife Grace, who had harbored ambitions of succeeding her husband, was also expelled from ZANU-PF, along with at least three cabinet ministers who had formed the backbone of her "G40" political faction.
Speaking before the meeting, Mutsvangwa said Mugabe, who has so far resisted calls to quit, was running out of time to negotiate his departure and should leave the country while he could. "He's trying to bargain for a dignified exit," he said.
If Mugabe refused to go, "we will bring back the crowds and they will do their business," Mutsvangwa told reporters.
Mnangagwa, a former state security chief known as "The Crocodile," is expected to head an interim post-Mugabe unity government that will focus on rebuilding ties with the outside world and stabilizing an economy in freefall.
The next presidential election is due in 2018.
On Saturday, hundreds of thousands of people flooded the streets of Harare, singing, dancing and hugging soldiers in an outpouring of elation at Mugabe's expected overthrow.
His stunning downfall is likely to send shockwaves across Africa, where a number of entrenched strongmen, from Uganda's Yoweri Museveni to Democratic Republic of Congo's Joseph Kabila, are facing mounting pressure to step down.
"READY TO DIE"
On Saturday, men, women and children ran alongside the armored cars and troops who stepped in to target what the army called "criminals" in Mugabe's inner circle.
Meanwhile, the man himself remained under house arrest in his lavish "Blue Roof" compound, watching the support from his party, security services and people evaporate.
Speaking from a secret location in South Africa, his nephew, Patrick Zhuwao, told Reuters Mugabe and his wife were "ready to die for what is correct" rather than step down in order to legitimize what he described as a coup.
Zhuwao, who was also sanctioned by ZANU-PF, did not answer his phone on Sunday. However, Mugabe's son Chatunga railed against those who had pushed out his father.
"You can't fire a Revolutionary leader!" he wrote on this Facebook page. "ZANU-PF is nothing without President Mugabe."
On Harare's streets, few seemed to care about the legal niceties as they heralded a "second liberation" and spoke of their dreams for political and economic change after two decades of deepening repression and hardship.
More than 3 million Zimbabweans - around 20 percent of the population - have emigrated to neighboring South Africa in search of a better life.
The huge crowds in Harare have given a quasi-democratic veneer to the army's intervention, backing its assertion that it is merely effecting a constitutional transfer of power, rather than a plain coup, which would risk a diplomatic backlash.
Despite the euphoria, some Mugabe opponents are uneasy about the prominent role played by the military, and fear Zimbabwe might be swapping one army-backed autocrat for another, rather than allowing the people to choose their next leader.
"The real danger of the current situation is that having got their new preferred candidate into State House, the military will want to keep him or her there, no matter what the electorate wills," former education minister David Coltart said.
The United States, a longtime Mugabe critic, said it was looking forward to a new era in Zimbabwe, while President Ian Khama of neighboring Botswana said Mugabe had no diplomatic support in the region and should resign at once.
Besides changing its leadership, ZANU-PF said it wanted to change the constitution to reduce the power of the president, a possible sign of its desire to move towards a more pluralistic and inclusive political system.
However, Mnangagwa's history as state security chief during the so-called Gukurahundi crackdown, when an estimated 20,000 people were killed by the North Korean-trained Fifth Brigade in Matabeleland in the early 1980s, suggested that quick, sweeping change was unlikely.
"The deep state that engineered this change of leadership will remain, thwarting any real democratic reform," said Miles Tendi, a Zimbabwean academic at Oxford University.
Additional reporting and writing by Ed Cropley; Editing by Mark Heinrich