Pakistan's former prime minister Imran Khan has apologised for criticising a magistrate, his lawyer said Thursday, likely averting a court case that could have seen him barred from standing for election.
Khan, an international cricket star turned politician, was ousted through a no-confidence vote in April but has been plotting his return, harrying the fragile new coalition government with popular protests calling for early elections.
On Thursday he appeared at the Islamabad High Court, where he risked being indicted for contempt of court if he failed to apologise for his comments that followed the detention of a close aide.
"Everybody should respect the court and that's what he's shown today," his lawyer Faisal Chaudhry told AFP. "If he has crossed some red line, he apologises for that."
The case is now "most likely to be dropped", he added.
Pakistan's courts are often used to tie up lawmakers in tedious and long-winding proceedings that rights monitors have criticised for stifling political opposition.
"Currently, I am fighting a war for real freedom," Khan told reporters afterwards. "I am not going to fight a war with the judiciary of Pakistan."
Khan's lawyers said the case still remained technically active and that he would submit a formal "affidavit of apology".
If he were convicted of contempt of court, Pakistan's constitution could disqualify Khan from holding office for the next five years.
General elections are due by the end of 2023.
The byzantine case against the former leader stems from his remarks over the police detention of aide Shahbaz Gill, who was arrested over comments about the country's powerful army.
Khan had also faced prosecution in an anti-terrorism court over the same remarks, but the case was dropped earlier this month.
The former PM was kicked out of power as the economy crumbled and he lost the support of Pakistan's military leaders, regarded as behind-the-scenes kingmakers in the country's chaotic politics.
Pakistan has been hit by devastating floods this monsoon season, with a third of the country affected and the government's flood relief centre estimating the provisional cost of the catastrophe could reach $30 billion.