Egypt's highest court of appeal has overturned death sentences against ousted President Mohammed Morsi and five other Muslim Brotherhood leaders.
The Court of Cassation ordered that the six men face a retrial in connection with a mass prison break during the 2011 uprising against Hosni Mubarak.
Twenty-one life sentences for other Brotherhood members were overturned.
Morsi was elected president in 2012 but was removed by the military a year later after protests against his rule.
Although he is no longer at risk of execution, Morsi is serving three lengthy prison sentences relating to other convictions.
Morsi and more than 100 other people were sentenced to death in May 2015 after being convicted of colluding with foreign militants - from the Palestinian Islamist movement Hamas and Lebanon's Shia Islamist Hezbollah movement - to organise a mass prison break.
Morsi was being held at Wadi Natroun prison in January 2011 when armed men overcame the guards, freeing thousands of inmates.
He and his co-defendants, including the Brotherhood's general guide Mohammed Badie, were also found guilty of the murder and kidnapping of guards, damaging and setting fire to prison buildings and looting the prison's weapons depot.
In June 2015, a court upheld the death sentence against Morsi and 98 others after consulting Egypt's Grand Mufti, Shawi Allam.
It was not immediately clear why the Court of Cassation overturned the sentences on Tuesday, but a Brotherhood lawyer said it had applied the law correctly.
"The ruling was expected because [Morsi's conviction] was legally flawed," Abdel Moneim Abdel Maksoud told the Reuters news agency.
Morsi has also been sentenced to life in prison for allegedly conspiring to commit terrorist acts with foreign organisations and to another 40 years for allegedly leaking state secrets and sensitive documents to Qatar.
He was sentenced to 20 years after being convicted of ordering the unlawful detention and torture of opposition protesters during clashes with Brotherhood supporters outside a presidential palace in Cairo in December 2012.
The prosecution of Morsi has taken place amid a wider crackdown on the Brotherhood, which President Abdul Fattah al-Sisi has outlawed and vowed to wipe out. Hundreds of people have been killed and tens of thousands of people imprisoned in the past three years.
Morsi's supporters have said the trials are politically motivated and attempts to give legal cover to a coup. They claim they are based on unreliable witnesses and scant evidence.
Also on Tuesday, the Court of Cassation approved the decision to release Hosni Mubarak's two sons from prison, the state-owned Mena news agency reported.
A lower court ruled in October 2015 that the time Alaa and Gamal Mubarak had spent in temporary detention exceeded the legal limit.
The two men, who were arrested soon after the 2011 uprising, were sentenced along with their father to three years in prison for embezzlement in May 2015.