Imran Khan, who was ousted as Prime Minister last April, was arrested from outside the Islamabad High Court on Tuesday in the Al-Qadir Trust case after the National Accountability Bureau (NAB) issued an arrest warrant against him.
Pakistan former prime minister Imran Khan was granted two weeks of bail by Islamabad High Court on Friday in a corruption case, a day after the Supreme Court called his arrest "invalid and unlawful".
The Islamabad High Court upheld Mr Khan's arrest but a three-member Supreme Court bench on Thursday had declared his detention "illegal" and ordered his immediate release.
The Friday hearing was delayed for nearly two hours due to security reasons. The cricketer-turned-politician arrived back at the Islamabad High Court in a secure convoy and walked into the building flanked by dozens of police and paramilitaries.
"The court has granted Imran Khan a two weeks interim bail and has directed the authorities not to arrest him in the [graft] case," Mr Khan's lawyer Khawaja Harris was quoted saying by news agency AFP.
Mr Khan raised a single fist above his head, signalling his gathered supporters.
But the legal saga seems far from over.
The interior minister has pledged to re-arrest Mr Khan, who has become tangled in a slew of legal cases.
Mr Khan, who was ousted as Prime Minister last April, was arrested from outside the Islamabad High Court on Tuesday in the Al-Qadir Trust case after the National Accountability Bureau (NAB), the country's top anti-corruption body, issued an arrest warrant against him.
The arrest by paramilitary Rangers triggered deadly clashes across the country, prompting the deployment of the Army. At least nine people died in the unrest, police and hospitals said.
Mr Khan has accused senior military and government officials of plotting a November assassination attempt that saw him shot in the leg during a rally.
General elections are due no later than October, and the former cricket star has accused the shaky incumbent coalition government of supplanting him in cahoots with top generals.
Mr Khan has remained wildly popular since being ousted.
His arrest this week came after the army rebuked him for once again repeating allegations they were involved in his assassination attempt.