Several thousand pro-government protesters demanded Monday the resignation of Pakistan's top judge for releasing Imran Khan from arrest last week, as the former prime minister went back to court facing yet more legal cases.

Khan, who was ousted from power in April last year, was arrested on corruption charges on Tuesday following months of simmering political crisis, prompting his voters to rampage through cities.

His arrest was declared unlawful by the Supreme Court's chief justice and Khan was later released and granted various protective bail applications.

"The chief justice and a few of his cronies are disgracing the judiciary like never before. Their justice seems to be serving one leader only," said Malik Hassam Mehmood, a 36-year-old trader and supporter of Prime Minister Shehbaz Sharif's party.

"We are here to protest for the rule of law and a non-partisan judiciary."

There was a heavy security presence in the capital on Monday as protesters gathered outside the court in the capital's so-called red zone.

The Supreme Court order said Khan's arrest last week as he arrived at the Islamabad High Court to file a bail application in the graft case "violated the petitioner's right of access to justice".

However, referring to the pro-government protesters, Interior Minister Rana Sanaullah said on Sunday that "people want to come in very large numbers because of a deep sense of anger and anguish".

Analysts say legal hurdles are often used to discourage dissent in Pakistan and Khan dismisses the cases arrayed against him as politically motivated.

Political analyst Mosharraf Zaidi said judges were split down the middle over the political crisis.

"The judiciary still makes compromises with both civilians and the military, but on many issues judges have repeatedly demonstrated the ability to take a stand and hold their ground," he told AFP.

- Tussle with military -

Former international cricket star Khan returned to the Lahore High Court on Monday, where his lawyers said they were seeking information on fresh cases linking him to the violence that followed his arrest. The case will continue Tuesday.

Khan was accompanied by his wife, Bushra Bibi, who was granted protective bail in the same corruption case that led to the former leader's arrest.

Their team erected a white curtain between their vehicle and the courtroom to shield the couple from the media.

At least nine people were killed, hundreds of police officers injured and more than 7,000 people detained in last week's unrest before Khan was released on bail on Friday, authorities said.

Sanaullah, who has vowed Khan will be rearrested, told reporters on Sunday the "terrorism and mobbing was all preplanned and this was done by Khan".

Elections are due no later than October and Khan has held a series of vastly popular marches challenging the authority of the shaky coalition of parties that replaced him.

He has also waged an unprecedented campaign of defiance against Pakistan's army, which has ruled for nearly half of Pakistan's 75-year history and continues to wield massive influence.

When Khan surged into office in 2018, most understood it was with the backing of the generals. Analysts likewise said when he left power it was because he had fallen out of favour with the top brass.

In opposition Khan has made explosive claims about the military's involvement in politics, including that they plotted a November assassination attempt in which he was shot in the leg while campaigning for fresh polls.

His arrest last Tuesday came just hours after he repeated the allegations at a rally.