LAS VEGAS — A judge has halted the execution of a twice-convicted killer who had been scheduled to be put to death in Nevada Wednesday night with an untried three-drug lethal injection.

Clark County District Court Judge Elizabeth Gonzalez filed a temporary injunction against the use of midazolam after a final-hour lawsuit by the pharmaceutical company that produces the drug, New Jersey-based Alvogen.

Drug companies have resisted the use of their products in executions for 10 years, citing both legal and ethical concerns. However, the legal challenge filed Tuesday in Nevada is only the second in the U.S, said Robert Dunham, executive director of the Death Penalty Information Center in Washington, D.C.

The previous challenge filed last year by a different company in Arkansas was unsuccessful in halting that execution.

A Nevada prisons spokeswoman declined to comment.

Scott Dozier appears in court on Sept. 11, 2017, at the Regional Justice Center in Las Vegas. George Romero / KSNV

Alvogen says it doesn't want its product used in "botched" executions. It said in court documents that Nevada prison officials illegally obtained the sedative midazolam and demanded that it be returned and not used in Dozier's execution.

"Midazolam is not approved for use in such an application," the document said, adding uses of midazolam in other states "have been extremely controversial and have led to widespread concern that prisoners have been exposed to cruel and unusual treatment."

Midazolam was substituted in May for expired Nevada prison stocks of diazepam, a similar sedative commonly known as Valium. Nevada's first-of-its-kind execution protocol also calls for the powerful synthetic opioid fentanyl to slow Dozier's breathing and the muscle paralytic cisatracurium to prevent movement and stop his breathing.

Nevada refused Pfizer's demand last year to return the company's diazepam and fentanyl, which has been blamed for overdoses nationwide but has not been used in an execution.

In the legal challenge in Arkansas last year, McKesson Corp. said it wanted nothing to do with executions and accused the state of obtaining vecuronium bromide, a drug used to stop inmates' lungs, under false pretenses.

The Arkansas Supreme Court ruled against the company and allowed that execution to go forward, but legal questions about whether pharmaceutical companies can block use of their drugs in the death penalty haven't been resolved, Dunham said.

Dozier, who attempted suicide in the past, has said he prefers death to life behind bars.

"I've been very clear about my desire to be executed ... even if suffering is inevitable," Dozier said in a handwritten note to a judge who postponed his execution in November over concerns the untried drug regimen could leave him suffocating, conscious and unable to move.

Dozier repeated his desire to die during recent interviews with the Reno Gazette Journal and Las Vegas Review-Journal.

"Life in prison isn't a life," the 47-year-old told the Review-Journal . He has not responded to messages through his lawyers to speak with The Associated Press.

Dozier, son of a federal water engineer, grew up in Boulder City, Nevada, and attended high school in Phoenix. He is an honorably discharged Army veteran; a divorced father who became an emergency medical technician during his then-wife's high-risk pregnancy; a pastels painter; a landscaper; and a methamphetamine user, maker and dealer.

He was close to his grandfather, who killed himself when Dozier was 5. He told a clinical psychologist who testified at his trial that he was sexually abused by a teenage male neighbor from ages 5 to 7.

The psychologist diagnosed Dozier with anti-social personality disorder with narcissistic traits.

There's a limit to how much artwork and exercise a person can do in prison, Dozier said in court hearings and letters to Clark County District Judge Jennifer Togliatti, who postponed his execution last year.

Togliatti presided over the 2007 trial in which a Nevada jury decided Dozier should die for murder convictions in Arizona and Nevada in separate slayings of drug-trade associates, according to court records.

In 2005, Dozier was sentenced to 22 years in prison for shooting 26-year-old Jasen Greene, whose body was found in 2002 in a shallow grave outside Phoenix. A witness testified that Dozier used a sledgehammer to break Greene's limbs so the corpse would fit in a plastic tote that Dozier used to transport meth, equipment and chemicals.

Dozier was sentenced to die for robbing, killing and dismembering 22-year-old Jeremiah Miller at a Las Vegas motel in 2002. Miller had come to Nevada to buy ingredients to make meth. His decapitated torso was found in a suitcase in an apartment building trash bin, also missing lower legs and hands. He was identified by tattoos on the shoulders. His head was never found.

Dozier suspended any appeals of his conviction and sentence, which would make him one of about 10 percent of the 1,477 inmates who gave up appeals and were executed nationwide since 1977, according to the Death Penalty Information Center.

He did, however, let federal public defenders challenge the execution protocol drawn up last year by state medical and prison officials. They argued the untried three-drug combination would be less humane than putting down a pet.

The judge invited state Supreme Court review, saying she expected the Nevada execution to be closely watched by officials in states that have struggled in recent years to identify and obtain drugs from pharmaceutical companies that don't want their products used for the death penalty.

The state high court in May decided on procedural grounds that the execution could go forward but did not review the three-drug protocol that death penalty experts have characterized as experimental and risky.

"Because Nevada is using a combination of drugs that no one has used before, there is a lot about its protocol that we don't know anything about," Dunham said.

When used in an execution, the midazolam is supposed to render the inmate unconscious before they are injected with the fentanyl. That would be followed by the muscle paralyzing drug.

Midazolam has been used with inconsistent results in states including Alabama, Arkansas, Arizona, Florida and Ohio. Dunham noted the 2014 executions of Dennis McGuire in Ohio and Joseph Rudolph Wood III in Arizona left both inmates gasping and snorting before they died.

Nevada's last execution occurred in 2006, when Daryl Linnie Mack asked to be put to death for his conviction in a 1988 rape and murder in Reno.