Mugabe, who had led Zimbabwe from independence in 1980, stepped down on Tuesday after the army seized power and the ruling party turned against him. Emmerson Mnangagwa, the former vice president sacked by Mugabe earlier this month, is set to be sworn in as president on Friday.
A government source said Mugabe, who is 93 and was the world's oldest serving head of state, told negotiators he wanted to die in Zimbabwe and had no plans to live in exile.
"It was very emotional for him and he was forceful about it," said the source, who is not authorised to speak on the details of the negotiated settlement.
"For him it was very important that he be guaranteed security to stay in the country...although that will not stop him from travelling abroad when he wants to or has to."
Mugabe resigned as parliament began a process to impeach him, sparking wild celebrations in the streets. His sudden fall after 37 years in power was triggered by a battle to succeed him that pitted Mnangagwa against Mugabe's much younger wife Grace.
"The outgoing president is obviously aware of the public hostility to his wife, the anger in some circles about the manner in which she conducted herself and approached ZANU-PF party politics," a second source said.
"In that regard, it became necessary to also assure him that his whole family, including the wife, would be safe and secure."
Mugabe had clung on to power for a week after the military intervened. He angered many Zimbabweans when he did not resign in a televised address on Sunday as many had anticipated.
The government source said the tipping point for Mugabe was the realisation that he would be impeached and ousted in an undignified way. "When the process started, he then realised he had lost the party," the source said.
Mugabe will receive a retirement package that includes a pension, housing, holiday and transport allowance, health insurance, limited air travel and security.
The elderly ex-president was "rugged and drained" by events of the past week and may travel to Singapore for medical checks in the coming weeks, the source said. He had been due to leave for the Southeast Asian country in mid-November before the military put him under house arrest.
Mugabe has maintained that he leads a frugal life and that he does not possess any wealth or properties outside Zimbabwe.
But last month a legal quarrel between Grace and a Belgian-based businessman over a $1.3 million diamond ring lifted a veil on the wealthy lifestyle of Mugabe and his wife, nicknamed "Gucci Grace" for her reputed dedication to shopping.
In Zimbabwe, Mugabe runs a dairy business and the family has several farms while local and foreign media have reported that Grace has bought properties and luxury cars in South Africa.
Meet The New Boss
Addressing a cheering crowd in Harare on Wednesday night, Mnangagwa said Zimbabwe was entering a new stage of democracy.
He had returned to the country earlier in the day, having fled for his safety when Mugabe sacked him as vice president two weeks ago to smooth a path to the succession for Grace.
"The people have spoken. The voice of the people is the voice of God," Mnangagwa told thousands of supporters gathered outside the ruling ZANU-PF party's offices in the capital.
Some of his supporters have been calling for unspecified action against the G40 group that backed Mugabe and his wife.
The army appears to have engineered a trouble-free path to power for Mnangagwa, who was for decades a faithful lieutenant of Mugabe and member of his elite.
His own human rights record also stirs hostility in many Zimbabweans.
Mnangagwa was Mugabe's state security minister in the 1980s when a Korean-trained army brigade cracked down on the minority Ndebele, who supported the PF-ZAPU party of Mugabe's then-main rival Joshua Nkomo.
Rights groups say up to 20,000 people died during the operation, which Mugabe later said was a moment of madness. Mnangagwa denied responsibility in an interview with Britain's New Statesman last December.
Restoring Zimbabwe's fortunes and international standing will be a challenge. Human rights abuses and flawed elections prompted many Western countries to impose sanctions in the early 2000s that further damaged the economy, even with Chinese investment to soften the blow.
Staging clean elections next year will be key to winning fresh funds.
In its first official comments since Mugabe resigned, the opposition Movement for Democratic Change said it was cautiously optimistic a Mnangagwa presidency would not "mimic and replicate the evil, corrupt, decadent and incompetent Mugabe regime".
Zimbabwe's bourse, which had been on a rapid rise, lost $6 billion during the military intervention as its main index fell by 40 percent. Analysts say it will fall even further before recovering. [nL8N1NT4FS]
Zimbabwe was once one of Africa's most promising economies but suffered decades of decline as Mugabe pursued policies that included the violent seizure of white-owned commercial farms and money-printing that led to hyperinflation.
Most of its 13 million people remain poor and face currency shortages and sky-high unemployment, something Mnangagwa promised to address.
An International Monetary Fund official said Zimbabwe's economic situation remained "very difficult" as sustainable growth is threatened by high government spending, an untenable foreign exchange regime and inadequate reforms. Immediate action is critical, Gene Leon, IMF mission chief for Zimbabwe said.
Britain's Minister for Africa, meanwhile, said the former colonial power wants Zimbabwe's new rulers to place the country on a more democratic and prosperous path.
"Zimbabweans suffered for too long as a result of Mugabe's ruinous rule," Minister Rory Stewart said on arriving in Harare.
(Editing by James Macharia/Mark Heinrich)
(Except for the headline, this story has not been edited by NDTV staff and is published from a syndicated feed.)
Election Results for Lok Sabha Election 2019 will be out on May 23. Get the latest election news and live updates on ndtv.com/elections. Catch all the action on NDTV Live. Like us on Facebook or follow us on Twitter and Instagram for news updates from each of the 543 parliamentary seats for the election 2019