HARARE, Zimbabwe (AP) — Zimbabwe’s President Robert Mugabe is resigning after nearly four decades in power, according to an official close to the talks on his departure, in an extraordinary end for the world’s oldest head of state who had vowed to rule until death.

The news came hours after the ruling party’s Central Committee on Sunday fired Mugabe as party leader and said if he didn’t resign as the country’s president by noon Monday it would start impeachment proceedings.

Mugabe was set to address the nation shortly on state-run television. The official close to the talks spoke on condition of anonymity because he was not authorized to speak to reporters.

The 93-year-old Mugabe has been under house arrest since the military moved in Tuesday, angered by his firing of his longtime deputy and the positioning of unpopular first lady Grace Mugabe to succeed him.

Mugabe tried to buy time in negotiations with the military on a dignified exit but quickly found himself isolated.

Tens of thousands of people poured into the streets of the capital Saturday to demand that Mugabe, one of Africa’s last remaining liberation leaders, step aside after overseeing the once-prosperous country’s economic collapse.

The deputy whom Mugabe fired, former Vice President Emmerson Mnangagwa, is poised to be Zimbabwe’s next leader after the Central Committee made him its nominee to take over when Mugabe goes.

Mugabe was speaking at the State House building where he holds official functions, a symbol of the rule of the man who took power after independence from white minority rule in 1980.

Clinging to his virtually powerless post, Mugabe earlier on Sunday discussed his exit with the army commander who put him under house arrest, in a second round of negotiations.

Meanwhile, members of the ZANU-PF party’s Central Committee stood, cheered and sang as Mugabe was recalled. Meeting chair Obert Mpofu referred to him as “outgoing president” and called it a “sad day” for Mugabe after his decades in power.

“He has been our leader for a long time and we have all learned a great deal from him,” Mpofu said. But Mugabe “surrounded himself with a wicked cabal” that brought him down.

The meeting replaced Mugabe as party chief with Mnangagwa and recalled the first lady as head of the women’s league. The Central Committee accused the first lady of “preaching hate, divisiveness and assuming roles and powers not delegated to the office.” The committee’s decisions will be formalized at a special party congress next month.

The Central Committee also expelled several high-level members close to the first lady, including minister of higher education Jonathan Moyo, finance minister Ignatious Chombo, Mugabe’s nephew Patrick Zhuwao, local government minister Saviour Kasukuwere, foreign affairs minister Walter Mzembi and several others.

Zimbabwean officials never revealed details of Mugabe’s talks with the military on his exit, but the military appeared to favor a voluntary resignation to maintain a veneer of legality in the political transition. Mugabe, in turn, likely was using whatever leverage he had left to try to preserve his legacy or even protect himself and his family from possible prosecution.

Chris Mutsvangwa, head of the country’s liberation war veterans, vowed to “bring back the crowd” if the president didn’t step aside but said he was concerned that the military would end up opening fire to protect Mugabe from protesters.

“We would expect that Mugabe would not have the prospect of the military shooting at people, trying to defend him,” Mutsvangwa said. “The choice is his.”

On Saturday, most of Harare’s population of 1.6 million poured into the streets in an anti-Mugabe demonstration that just days ago would have brought a police crackdown.

They clambered onto tanks moving slowly through the crowds, took selfies with soldiers and surged in the thousands toward the State House building.

The euphoria came after years of watching the once-prosperous African nation fall into decay, with a collapsing economy, repression of free speech, disputed elections and international sanctions.

Even as concerns remained about who next would be in charge, people reveled in the rare chance to express themselves freely.

Let us have this moment, Zimbabweans said. If the next leader becomes trouble, they vowed to return to the streets again.