Hosni Mubarak, overthrown as president of Egypt in 2011 and the first leader to go on trial in the wake of the Arab Spring, will walk free this week for the first time in six years.
The 88-year-old was cleared of murder charges this month in his final court appearance, having stood trial on charges ranging from corruption to ordering the killing of some of the protesters who ended his 30-year rule.
Mubarak was initially arrested in April 2011, two months after stepping down, and has since been in prison and military hospitals.
"He will go to his home in Heliopolis," Mubarak's lawyer Farid El Deeb said, referring to the Cairo neighborhood where the main presidential palace from which Mubarak governed is also located. El Deeb said the ageing former president could be released on Tuesday or soon after.
Mubarak still had one more jail sentence to serve, for appropriating funds reserved for maintaining presidential palaces, but time he had spent in detention in connection with the murder charges was subtracted from it, judicial sources and the state news agency said.
Mubarak was originally sentenced to life in prison in 2012 for conspiring to murder 239 demonstrators during the 18-day revolt.
An appeals court ordered a retrial that culminated in 2014 in the case against Mubarak and his senior officials being dropped. An appeal by the public prosecution led to a final retrial by the Court of Cassation, the highest in the country, which acquitted him on 2 March.
Back to the past?
After the turmoil of the Arab Spring, former Tunisian President Ben Ali fled into exile in Saudi Arabia, Libyan leader Muammar Gaddafi was killed by rebels and former Yemeni President Ali Abdullah Saleh is fighting a civil war after stepping down.
Bashar al-Assad still holds the title of president in a Syria that lies largely in ruins after years of civil war.
Many Egyptians who lived through Mubarak's rule view it as a period of autocracy and crony capitalism. His overthrow led to Egypt's first free election, which brought in Islamist President Mohamed Mursi.
Mursi lasted only a year in office after mass protests against his rule in 2013 prompted his overthrow by then defense chief General Abdel Fattah al-Sisi, who went on to win a presidential election in 2014.
Mursi is in prison and his Muslim Brotherhood has been banned as a terrorist organization.
Hundreds of Mursi supporters were killed in a single day in August 2013 and thousands were jailed, with the dragnet quickly widening to include secular activists who were at the forefront of the 2011 uprising but opposed Muslim Brotherhood rule.
Mubarak-era figures, meanwhile, are gradually being cleared of charges and a series of laws limiting political freedoms has raised fears among activists that the old regime is back.
Mubarak has long maintained his innocence and says history will judge him a patriot who served his country selflessly.