The first execution in the US using the opioid drug fentanyl is expected to take place on Tuesday after a federal appeals court rejected a German pharmaceutical company’s move to block the killing.

The court gave the go ahead on Monday for Nebraska to put to death Carey Dean Moore on the grounds it is the “will of the people”. Moore has been on death row for four decades for the 1979 murders of two cab drivers in Omaha.

Nebraska has included fentanyl – a synthetic opioid found in more than 20,000 overdose deaths in 2016 alone – in the cocktail of drugs it intends to use for its first execution in 21 years after struggling to buy pharmaceuticals in the face of opposition from manufacturers and distributors.

Moore, who has said he wishes to die, is among the longest serving prisoners on death row in the US.

Moore will be given the sedative Valium alongside fentanyl, a combination increasingly found in drug overdose deaths because they both suppress breathing.

The legal challenge to the execution by the German drug maker, Fresenius Kabi, was brought over the use of two other drugs included in the fatal cocktail which the company accuses Nebraska of obtaining illegally, potassium chloride to stop Moore’s heart and a muscle relaxant.

The pharmaceutical company said it took no position on the death penalty but that its contracts with drug distributors bar sales for use in capital punishment.

Fresenius Kabi said there is a risk of grave harm to its reputation because it said Nebraska has not properly stored the drugs and that could lead to a botched and painful execution.

The director of the state’s prisons, Scott Frakes, has refused to make public how Nebraska bought the drugs but said that those made by Fresenius Kabi expire within weeks and that, if they are not used now, the state would have to find new supplies.

The appeals court on Monday upheld a lower court ruling that said blocking the execution would “frustrate the will of the people” because 61% of voters in Nebraska voted to reinstate the death penalty two years ago after the state legislature abolished it.

The appeals court said that Fresenius Kabi was not likely to suffer irreparable injury from the use of its product.

The American Civil Liberties Union in Nebraska has accused the state’s governor, attorney general and prisons department of failing to obey open records laws and described secrecy around the execution as “incredibly troubling”.

“While more states are turning away from the death penalty, Nebraska officials are rushing to carry out an execution cloaked in secrecy with an untested four-drug scheme that carries immeasurable risks for unnecessary pain and a botched execution,” said Danielle Conrad, director of the ACLU Nebraska.

The state is not alone in seizing on fentanyl as an option, as the potent drug flooded into the US and moved to the heart of the opioid crisis.

A judge in Nevada indefinitely postponed an execution last month after another drug company objected to the use of one of its drugs in an execution where fentanyl was intended to provide the fatal dose.

In that case, the state was accused of deceiving one of the country’s largest pharmaceutical distribution companies into believing the drugs were intended for the prison hospital system.