The army's headquarters were breached by protesters supporting Khan.
Former Pakistani Prime Minister Imran Khan was granted two weeks of bail by Islamabad's high court Friday, one day after the Supreme Court ruled his arrest on corruption charges was unlawful.
The ruling came in the wake of violent and unprecedented protests in Pakistan since Khan's arrest on Monday.
At least six people have been killed and more than 150 were injured in protests across the country. Khan's party claims the figures are much higher.
Much of the anger from protesters has been pointed at Pakistan's powerful military, which Khan alleges played a major role in his ouster from government through a no-confidence vote in mid-April last year.
"The military itself feels fairly divided as far as its political thinking is concerned," retired Lt. Gen. Talat Masood, a former three-star general in the Pakistani army and current political commentator, told ABC News.
Khan, who led Pakistan from August 2018 to April 2022, is facing hundreds of charges, mostly related to corruption. He has accused current Prime Minister Shehbaz Sharif of being behind the charges and Khan still carries strong support among many Pakistanis.
Earlier this week, angry protesters breached the front gate of the the army's headquarters in Rawalpindi, a move that shocked a country used to the military's stronghold on Pakistan since its creation in 1947. Protesters also ransacked and set ablaze the official residence of the army's commander in Lahore.
In response to the violent protests, the military said Wednesday it will exercise "patience and restraint" in the national interest, but added that all the "facilitators and planners" who were involved have been identified and will be punished according to the law.
Thousands of Khan's supporters rallied in the capital, Islamabad, on Friday to celebrate his temporary release.
Khan has demanded an early election across the country ahead of the end of the incumbent government's tenure in August. But that seems unlikely with the incumbent government aware it is facing inflation, a caving economy, rising unemployment, bad governance and the looming threat of terrorism.
On Friday, a major paramilitary base in Baluchistan province came under attack with the military's elite commandos called to deal with the situation.
"The political situation couldn't be more confrontational than what it is today," said Masood, who added he doesn't see things getting better with the present arrangement.
24/7 coverage of breaking news and live events