Former Pakistan prime minister Imran Khan accused the government Thursday of trying to score a "technical knockout" against him, after being granted bail on charges brought under the country's anti-terrorism act.
Khan's court appearance is the latest twist in months of political wrangling that began when he was ousted by a vote of no confidence in the national assembly in April.
The former cricket star retains widespread support, however, staging mass rallies railing against Prime Minister Shehbaz Sharif's government and scoring successes in recent provincial assembly by-elections.
A court judgement was not immediately available, but officials from Khan's Pakistan Tehreek-e-Insaf (PTI) party said he had been granted "interim bail" until September 1.
The latest allegations against Khan stem from a weekend rally when he criticised a magistrate responsible for keeping a PTI official in police custody, after party leaders said he was "tortured".
Outside the court, Khan repeated his criticism of the judge and said the government was running scared because of his popularity.
PAY ATTENTION: Follow us on Instagram - get the most important news directly in your favourite app!
"Due to that fear, they are looking for technical knockouts. Just to save themselves, they are making a mockery of the country," he said.
The political crisis comes as officials struggle to deal with record monsoon rains that have flooded a vast swathe of the country.
Figures from the national disaster agency showed Thursday that 903 people had died in the floods since June, and more than 180,000 were forced to flee their rural homes.
The economy is also in free fall, with the country at risk of defaulting on foreign loans unless, as expected, the International Monetary Fund approves the resumption of a $6 billion bailout package next week.
Khan and other senior party officials have faced a raft of charges since being booted from office.
The country has a history of those in power using the police and courts to stifle their political opponents, and premier Sharif has several pending cases brought against him while in opposition.
One senior PTI official, Shahbaz Gill, has been in detention for nearly two weeks after being arrested following a TV interview in which he urged army officers to disobey orders that went against the interests of the country.
Khan said Gill had been tortured and sexually abused in custody, and vowed action against those responsible.
"That includes the inspector general, deputy inspector general of police and a magistrate who sent him on physical remand despite knowing he was tortured," he said.
Khan said the government had turned the country into a "banana republic".
"There is no law here and any charges can be brought against anyone," he said.
Khan's main goal is an early general election -- the next one must be held before October next year -- but the government has shown no sign of wanting to go to the polls.
"I think if an election is not called soon, Imran Khan's popularity will further grow so he shouldn't be concerned," said Talat Masood, a former general and now political analyst.
"These massive demonstrations show that Imran Khan has the backing of millions of supporters, but this also shows that the public lacks interest in parliamentary democracy," he said.
Khan swept into power in 2018 thanks to an electorate weary of the dynastic politics of the country's two major parties, promising to sweep away decades of entrenched corruption and cronyism.
But under his rule the country's economy went backwards, and the IMF suspended the loan programme that the new government has only just gotten back on track.
Khan also lost the support of the powerful military.
Still, analyst Masood said he doubted the former premier would be jailed on any of the charges he faces.
"The courts might fine him, but going harder will be counterproductive," he said.