Egypt's deposed president Mohamed Morsi has had a life sentence overturned by the country's Court of Cassation, which ordered a retrial in the case that revolves around accusations of espionage with Palestinian group Hamas.

Morsi, Egypt's first democratically elected president, had a death sentence overturned by the same court last week and a retrial was ordered.

Morsi was overthrown by a military coup in July 2013 after having served just one year of a four-year term.

Analysis: Why was Morsi's life sentence overturned in Egypt?

The organisation to which he belonged, the Muslim Brotherhood, has since been outlawed. A government crackdown on the movement, as well as other groups, has resulted in tens of thousands of arrests and mass trials. 

Morsi's lawyer, Abdel Moneim Abdel Maqsoud, told AFP news agency that the sentences against several Muslim Brotherhood officials, who stood trial alongside Morsi on charges of spying for Iran and Hamas, were also overturned.

Explaining the recent ruling, Yehia Ghanem, Al Jazeera's Middle East analyst, said "from a judicial point of view, the court of cassation is the least politicised court in the country".

"The authorities in Egypt established a special judicial district three years ago to deal mainly with cases of what they call 'terrorism', or espionage and other charges that are politicised," Ghanem said. 

This district is where Morsi and thousands of others have been tried, Ghanem adde, and "any opposition in Egypt is now tried under 'terrorism'". 

Morsi was previously tried on several charges, including one for escaping prison during the 2011 uprising against then-president Hosni Mubarak.

PROFILE: Egypt's deposed president Mohamed Morsi

He was also accused of sharing state secrets with foreign powers, including Qatar. His defence argued that he was merely engaging all foreign entities within the limits that any head of state would.

"Looking at the indictment, there were a lot of mistakes, discrepancies, and contradictions," Ghanem said about Morsi's trial.

"The trial itself failed to come up with any evidence to substantiate the charges."

Morsi's trials, and the trials of thousands of other opposition figures and civilians over the last three years, have been criticised heavily by rights groups, including Human Rights Watch and Amnesty International.

Morsi was given several sentences, including life, a 20-year prison term and the death penalty. He appealed against those sentences, but has already had the 20-year term confirmed by an Appellate Court.

He remains in jail on a separate espionage conviction. 

Inside Story - Is Egypt facing a crisis?

Source: News Agencies