On Thursday, the state of Ohio is scheduled to inject Dennis McGuire, 53, with two drugs: first, the sedative midazolam; then, the painkiller hydromorphone. When it is over, McGuire, who was convicted of the 1989 rape and murder of Joy Stewart, will be dead – which is Ohio’s goal. But the procedure is untried and untested; the drugs that the state will employ have never been used in a death chamber. And experts have warned in legal proceedings that if the process goes wrong, McGuire will not just peacefully drift away, but will be awake, struggling and failing to pull enough air into his lungs, until the drug overdose that will kill him takes hold.

"McGuire will experience the agony and terror of air hunger as he struggles to breathe for five minutes after defendants intravenously inject him with the execution drugs," his lawyers have said in court documents.

But on Monday a federal judge in Columbus, Ohio, ruled that McGuire's execution could go ahead. Judge Gregory Frost found that there was insufficient evidence to show a substantial risk of severe pain for the condemned man and said that “Ohio is free to innovate and to evolve its procedures for administering capital punishment.”

An Ohio state prosecutor, addressing the court, said: "You're not entitled to a pain-free execution.”

Ohio's use of the new two-drug combination is a move of desperation, one forced by shortages of the anaesthetic pentobarbital that had been relied upon in the three-drug cocktail used for executions by lethal injection all over the US. The approved supplies of pentobarbital in death penalty states across the US have all passed their expiration dates following European restrictions on exportation of the substance and a strict prohibition of sales to prison services imposed in 2011 by the drug's Danish manufacturer Lundbeck.

The dearth of approved pentobarbital may also lie behind a disturbing event at an execution in Oklahoma last week that could provide a preview of what will happen when states turn to new procedures as Ohio has. On Thursday, Michael Lee Wilson, 38, was put to death amid evidence that the procedure caused him considerable pain.

About 20 seconds into the execution, Wilson uttered what were, according to an Associated Press reporter who witnessed the execution, his final words: “I feel my whole body burning”.

The precise cause of Wilson's apparent agony is unknown because Oklahoma, like most death penalty states, shrouds its execution records in secrecy. It is theoretically possible that the department of corrections administered the three drugs in its current protocol in the wrong order: the last of the drugs, potassium chloride, which is used to stop the heart, is known to cause an excruciating burning sensation should the prisoner be partially conscious at that stage.

But most focus is falling on the first of the three drugs, pentobarbital.

According to the UK-based human rights group Reprieve, which has played a leading role in the boycott of medical drugs employed in executions, Oklahoma might have used a supply of the anaesthetic that had gone beyond its expiration date. All known batches of pentobarbital approved by the US Food and Drug Administration have expired in the wake of Lundbeck’s export ban, though whether the condition of the drugs was problematic in this case is impossible to tell, as it would depend on the date the batch was produced, which has not been made public.

Another possible route would have been to use pentobarbital made up expressly for the purpose by a so-called compounding pharmacy. In 2012, compounding pharmacies, which are not federally regulated, came under public scrutiny after a batch of steroid contaminated with fungus was shipped from the New England Compounding Center in Massachusetts, causing widespread fatalities.

Maya Foa, the acting director of the death penalty team at Reprieve, said her “strong suspicion” was that Oklahoma had used pentobarbital made by a local compounding pharmacy. Further evidence pointing to that likelihood is that an investigation by St Louis Public Radio and the Beacon revealed that Missouri intends to execute one of its death row inmates later this month using pentobarbital compounded in Oklahoma.

“We know from recent history that compounded drugs can be ineffective or contaminated. We are moving further and further away from anything that could be described as humane,” Foa said.

David Waisel, an associate professor of anaesthesia at Harvard medical school, said that last week's execution in Oklahoma might be an example of the possible risks involved in using compounded drugs. “Whatever you say about the death penalty, the penalty itself is not supposed to be suffering. Society should not seek to add pain, as death is enough,” he said.

Incidents of pain and suffering caused by lethal injections have been rife since the three-drug procedure was introduced more than three decades ago. In the first ever execution of its sort, that of Charles Brooks in Texas on 7 December 1982, witnesses said that he “did not die easily”.

In 2008 the US supreme court upheld the three-drug method. But less than a year later, in September 2009, executioners stopped the lethal injection of Romell Broom after they struggled for two hours to find a vein. The debacle occurred in Ohio – the state that is preparing to use the new and untested two-drug protocol on Thursday.

“From the first lethal injection in 1982, to last week's events in Oklahoma, lethal injections have been botched repeatedly over the past 32 years,” said Deborah Denno, a specialist in execution methods who is a law professor at Fordham University. “The lethal injection has never been more unpredictable and more at risk than it is right now.”