A court in Pakistan has overturned the death sentence handed down to former president Pervez Musharraf by declaring the legal process unconstitutional.
Gen Musharraf had challenged the formation of special court which found him guilty of treason last December.
On Monday, the Lahore High Court sided with the exiled general, who seized power in a 1999 coup and was president from 2001 to 2008.
The decision meant Gen Musharraf was "a free man", one prosecutor said.
"The filing of the complaint, the constitution of the court, the selection of the prosecution team are illegal, declared to be illegal... And at the end of the day the full judgment has been set aside," the government prosecutor, Ishtiaq A. Khan, explained to news agency AFP.
He added there was "no judgment against him any longer".
According to BBC Urdu, the long-running case - which relates to Gen Musharraf's suspension of the constitution in 2007, when he declared an emergency in a move intended to extend his tenure - could still be retried in another court.
The indictment in 2014 was a highly significant moment in a country where the military has held sway for much of its independent history, with no other military leader ever facing such legal consequences for their actions.
When the verdict finally came in December, it was strongly opposed by both the military and the current government.
But the penalty was unlikely to be carried out. Gen Musharraf, who has always denied any wrongdoing, was allowed to leave Pakistan in 2016 on medical grounds and is in Dubai where he is receiving medical treatment.
The ruling allowed for this, saying if Gen Musharraf died before he could be executed "his corpse (should) be dragged to D-Chowk, [outside parliament in] Islamabad, Pakistan, and be hanged for three days".
The directive sparked outrage, with the government seeking to disbar the panel's head judge, according to news agency Reuters.
What is the case about?
In November 2007, Gen Musharraf suspended the constitution and imposed emergency rule - a move which sparked protests. He resigned in 2008 to avoid the threat of impeachment.
When Nawaz Sharif - an old rival whom he deposed in the 1999 coup - was elected prime minister in 2013, he initiated a treason trial against Gen Musharraf and in March 2014 the former general was charged for high treason.
Gen Musharraf argued the case was politically motivated and that the actions he took in 2007 were agreed by the government and cabinet. But his arguments were turned down by the courts and he was accused of acting illegally.
In a video, Gen Musharraf said he was not receiving a fair hearing
According to the Pakistani constitution, anyone convicted of high treason could face the death penalty. Gen Musharraf travelled to Dubai in 2016 after a travel ban was lifted and he has refused to appear before the court, despite multiple orders.
The three-member bench had reserved its verdict in the long-running case last month but was stopped from announcing it by a petition filed by the federal government to the Islamabad High Court.