Former Pakistan prime minister Imran Khan was granted bail by the Islamabad High Court on Friday, after his arrest on corruption charges this week sparked deadly clashes before being declared illegal.
The high court also ruled that Khan could not be arrested before Monday in any other case registered against him.
Several thousand of his supporters have rampaged through cities across the country in protest at Khan's detention since Tuesday, setting fire to buildings, blocking roads and clashing with police outside military installations.
"The head of the country's largest party was abducted, kidnapped from the high court, and in front of the entire nation," Khan told AFP from the court building, where he remained late Friday hours after his hearings ended.
"They treated me like a terrorist, this had to have a reaction," he said of the protests that followed.
Police used tear gas to hold back protestors who gathered a few kilometres away from the court, which was heavily guarded, with
Islamabad police had issued an emergency order banning all gatherings in the capital city after Khan's Tehreek-e-Insaf (PTI) party called for supporters to come together.
Faisal Hussain Chaudhry, a lawyer for Khan, told reporters that further arrests of senior PTI leaders had brought the total number to 10.
"The country needs peace but such steps by the government are not helpful," he said.
Despite the ruling on the legality of Khan's arrest, Interior Minister Rana Sanaullah refused on Thursday to back down.
"If (Khan) gets bail from the High Court tomorrow, we will wait for the cancellation of bail and arrest him again," Sanaullah told Dunya TV.
Khan's arrest came after the army rebuked him for once again repeating allegations they were involved in his assassination attempt.
Pakistani politicians have frequently been arrested and jailed since the country's founding in 1947.
But few have so directly challenged a military that holds influence over domestic politics and foreign policy and has staged at least three coups and ruled for more than three decades.