Pakistan’s ex-prime minister Imran Khan is to be freed from custody, a day after the Supreme Court ruled his dramatic arrest on corruption charges was illegal.
Judges granted Mr Khan protected bail, meaning he can not be re-arrested on those charges for at least two weeks.
Earlier, Mr Khan told the BBC he feared he would be detained again immediately after his release.
The 70-year-old’s arrest escalated tensions between him and the military.
Many analysts believe Mr Khan’s election win in 2018 happened with the help of the military, which both parties denied.
But he later fell out with the army. After a series of defections, and amid mounting economic crises, he lost his majority in parliament.
Since being ousted less than four years into his term, he has become one of the military’s most vocal critics, and analysts say the army’s popularity has fallen.
And his Pakistan Tehreek-e-Insaf (PTI) party says the charges against him – which relate to gifts given to him by foreign leaders while he served as prime minster – are politically motivated.
His dramatic arrest outside the courthouse in the capital Islamabad on Tuesday sparked outrage among Mr Khan’s supporters.
At least 10 people were killed and some 2,000 arrested as unrest swept the country. Those protests included an attack at a military commander’s home residence in Lahore, which was set on fire.
While this week’s violence petered out after the army was deployed in Islamabad and other areas, such as Punjab and Khyber Pakhtunkhwa, the country remains on edge.
There was a large security presence at the court on Friday.
Speaking to the BBC before his bail hearing, Mr Khan said he feared immediate re-arrest once released, urged authorities against a move as “there might be huge reaction which will go out of control. Because mobs are out of control, no-one controls mobs.”
“How am I supposed to control what happens afterwards?” he told the BBC.
While the Supreme Court ruled on Thursday that the circumstances of the arrest were illegal, the corruption charges against him still stand.
Mr Khan pleaded not guilty to the charges on Wednesday, when a judge formally indicted him with corruption for the first time in the dozens of cases he faces.
And Mr Khan told the BBC on Friday that he was also facing dozens of additional charges, including counts of terrorism, sedition and blasphemy.