Former president is assured that his safety and that of his wife, Grace, will be protected in his home country

Military authorities in Zimbabwe have agreed to grant the former president Robert Mugabe immunity from prosecution and a “generous pension” and have told him his safety will be protected in his home country.

Mugabe, who ruled Zimbabwe with an iron fist for 37 years, resigned on Tuesday, hours after parliament launched proceedings to impeach him. He had refused to leave office during eight days of uncertainty that began with a military takeover.

Emmerson Mnangagwa, the former vice-president sacked by Mugabe this month, is to be sworn in as president on Friday.

Mugabe held out for protection of businesses belonging to his family as he negotiated a deal that would allow him to live in Zimbabwe after his resignation.

Sources close to the negotiations said the 93-year-old refused to leave Zimbabwe, saying he wanted to die there, and rejected safe passage to exile in Singapore and Malaysia, where he has been receiving medical treatment and is believed to have several properties.

“Much of the deal is around the family, his wife and kids so that they are not touched,” said one source.

It is thought the immunity deal covers Mugabe’s numerous extended family, including his stepson and nephews, and may also include senior ruling party officials detained by the military or in hiding overseas.

There is still much residual respect for Mugabe in Zimbabwe, and many in Harare say he should be allowed to “rest” rather than face charges or enforced exile. However, his wife, Grace, 52, and the ministers who supported her bid for power are reviled by many.

The military gave safe passage this week to Jonathan Moyo and Saviour Kasukuwere, leaders of the G40 faction loyal to the former first lady, officials said. Both had sought refuge in Mugabe’s residence during the takeover and were held under house arrest there by the military during the eight-day crisis.

“The delays in [Mugabe] resigning were because of the tally of all his investments, the negotiations took much longer because of the investments, so the delay was because of the vast empire which he has that had to be accounted for,” said the source.

The former president is expected to receive a pension from the state after “serving for [so long]”, which would be “quite generous”.

“He insisted that he was being asked to step down when he was going to win an election next year. So he was also refusing, wanting to stand in polls next year,” the source said.

A government source confirmed to Reuters that Mugabe had told negotiators “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”.

A second source, who was not authorised to speak on the details of the negotiated settlement, said: “The outgoing president is obviously aware of the public hostility to his wife [Grace], the anger in some circles about the manner in which she conducted herself and approached Zanu-PF party politics.

“In that regard, it became necessary to also assure him that his whole family, including the wife, would be safe and secure. It was very emotional for him and he was forceful about it.”

Play Video 3:52 Robert Mugabe: end of an era - video profile

Zanu-PF officials told the Guardian that Mugabe and his wife would be allowed to live in peace.

Ziyambi Ziyambi, a Zanu-PF MP and former minister, said both had been guaranteed immunity from prosecution and other unspecified protections.

“There has been an agreement. They are elder statesmen and will be respected and given their dues. He was our president and he agreed to resign, so he will enjoy the benefits of being an ex-president, and his wife too. He is our icon,” Ziyambi said.

On Wednesday, Mnangagwa, 75, a liberation war veteran, said the country was witnessing a “new and unfolding democracy” as he returned to a jubilant welcome two weeks after fleeing to South Africa.

Mugabe had 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 him 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 generosity of the package is likely to anger many in Zimbabwe, where unemployment is as high as 80%, many live in deep poverty and opposition has been brutally repressed over decades.

Zimbabweans are delighted at Mugabe’s fall, but democracy won’t come overnight | Basildon Peta Read more

Mugabe was “drained” by the events of the past week and may travel to Singapore for medical checks in the coming weeks, one source told Reuters. He had been due to leave for Singapore in mid-November before the military put him under house arrest.

Mugabe has always maintained that he leads a frugal life and does not possess any wealth or properties outside Zimbabwe.

But last month a legal quarrel between Grace Mugabe and a Belgian-based businessman over a $1.3m (£1m) diamond ring lifted a veil on the lifestyle of his wife, nicknamed “Gucci Grace” for her reputed dedication to shopping. The family is believed to have an extensive portfolio of luxury homes overseas.

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 cars worth millions of dollars in South Africa.