A military backed court in Pakistan has torpedoed efforts by the embattled ruling party to find a new prime minister by ordering the arrest on of the leading candidate just hours after he had been nominated.

Makhdoom Shahabuddin was accused by the court of using his former position as health minister two years ago to allow huge quantities of chemicals to be diverted to producers of illegal methamphetamine.

On the eve of a parliamentary vote on a new prime minister the ruling Pakistan People's Party (PPP) promptly dropped their candidate.

Even by Pakistan's high standards of political intrigue Shahabuddin's short-lived nomination came as a surprise and heightened concerns that a government at loggerheads with powerful state institutions, including an increasingly assertive judiciary and a military that has long disliked PPP rule, will struggle to remain in power much longer.

The latest political crisis was triggered on Tuesday when the supreme court ordered the sacking of the prime minister, Yousaf Raza Gilani, following months of legal skirmishing over his refusal to reopen a dormant money laundering investigation into President Asif Ali Zardari.

But barely six hours after Shahabuddin, a feudal landlord and close ally of Zardari, was nominated to replace him, a magistrate from the Anti Narcotics Force issued its arrest warrant accusing him of approving the manufacture of an enormous quantity of ephedrine by two pharmaceutical companies during his time as health minister.

Drug control officials say the 2,500kg allotted to the two companies involved was far in excess of that required for the substance's legal use for making cold medicines.

The companies are said to have passed the ephedrine on to producers of meth, a highly addictive drug on the rise in South Asia.

The arrest warrant also ordered the detention of Ali Musa Gilani, the son of the recently deposed prime minister, for his alleged involvement in the scam.

Although Shahabuddin has been linked to the case for some time, the timing of the warrant is seen as deeply suspicious, with analysts assuming either the country's military establishment or the judiciary must be behind it.

The ruling party now has to decide whether to tell its MPs to vote for one of two other possible candidates: former ministers Qamar Zaman Kaira or Raja Parvez Ashraf. Ashraf is thought to be less likely as he has been implicated in yet another scandal involving private electricity generating companies.

Even when a head of government is appointed there remain grave doubts over whether the PPP will be able to cling on to any prime minister for very long.

The new prime minister is likely to immediately run into the same legal quagmire that led to the downfall of Gilani – a demand by the supreme court that he write to authorities in Switzerland formally requesting a reopening of the fraud case against Zardari, something the PPP is determined not to do.

"If the next prime minister refuses to write that letter he might survive for a couple of weeks or maybe a month before facing disqualification by the court," said Raza Rumi, policy director of the Jinnah Institute thinktank. "A similar clash with the supreme court is absolutely on the cards."

Continued deadlock between the court and the government will smother any hopes of the country grappling with the many serious problems it faces, including Taliban militancy on its western border, a crippling energy crisis, freefalling economy and acrimonious relations with the United States.

The crisis may ultimately force fresh elections, robbing the PPP of its goal of becoming the first government in Pakistan's history to finish a full five-year term in office.