ISLAMABAD (Reuters) - Pakistan has dismissed a High Court judge who accused its spy agency of interfering in judicial proceedings to influence the July election, the law ministry said on Friday, following an investigation demanded by the military.

Poll “rigging” claims spread after ousted premier Nawaz Sharif accused the powerful military of influencing the judiciary to deny his Pakistan Muslim League-Nawaz (PML-N) party a second time and install Prime Minister Imran Khan instead.

The military denies interfering in politics and judicial affairs and Khan has denied colluding with the armed forces.

“The President of Pakistan has been pleased to remove Mr. Justice Shaukat Aziz Siddiqui ... from his office with immediate effect,” the law ministry said in a notification, without elaborating.

The news followed a dismissal recommendation by a panel of judges headed by the chief justice, which called Siddiqui’s remarks “conduct unbecoming of a judge of a high court”.

Siddiqui, a judge of the Islamabad high court, had accused Pakistan’s premier spy agency, Inter Services Intelligence (ISI), which is controlled by the military, of interfering in legal cases days before the July 25 general elections.

“The ISI is fully involved in trying to manipulate the judicial proceedings,” Siddiqui had told lawyers in a speech, adding that the agency had told the court not to release Sharif and his daughter Maryam until after the elections.

Sharif and his daughter had been arrested in July upon their return from Britain after being sentenced in absentia to jail terms of 10 years and seven years each on corruption charges over the purchase of upscale apartments in London.

They had been looking after Sharif’s now-deceased wife, who was receiving medical treatment in London at the time.

Last month, the Islamabad High court ordered their release on bail after suspending the prison sentences, saying the prosecution had failed to show the properties belonged to Sharif.

Last week, his brother, Shehbaz Sharif, the current leader of the party, was arrested in a longstanding corruption case, days before pivotal by-elections for 11 parliamentary seats and 19 provincial assembly seats are due.

Siddiqui is also being investigated for alleged misconduct over the allocation and refurbishment of his official residence. He has denied the charges.

In a March ruling that human rights advocates called a blow for Pakistan’s persecuted minorities, Siddiqui said citizens who hid their religious affiliation were guilty of betraying the state and told government jobseekers to declare their faith.