Judge Neil Gorsuch has been front and center as Oklahoma’s death penalty process has been repeatedly called into question in recent years, hearing key cases at the US Court of Appeals for the 10th Circuit over the state’s handling of executions — and siding with the government.

Just a few months ago, Gorsuch — now President Trump’s nominee for the Supreme Court — ruled against the estate of a man who was executed in one of the worst botched lethal injections in US history. Gorsuch and two other judges ruled that it was an “innocent misadventure” or an “isolated mishap,” but not cruel and unusual punishment.

In that case, Clayton Lockett’s estate sued the state of Oklahoma for constitutional violations in his 43-minute execution. Lockett was given a controversial sedative called midazolam, then two drugs that cause immense pain: a paralytic and a drug to stop the heart.

After he was injected with the drugs, Lockett raised himself on the gurney and said, “Shit is fucking with me.” Executioners had thought he was already dead.

Members of the state’s execution team examined his IV, which was set up near his groin and covered by a blanket. When they moved the blanket, they discovered the IV had infiltrated, creating swelling the size of between a golf ball and a tennis ball. The drugs weren’t going into his veins like they were supposed to.

The prison warden called it a “bloody mess.” The state attempted to call off the execution 30 minutes in, but Lockett died anyway 10 minutes later.

“Everyone acknowledges that Lockett suffered during his execution,” Judge Gregory Phillips wrote in a ruling against his estate, which Gorsuch signed on to.

“Here, the Amended Complaint describes exactly the sort of ‘innocent misadventure’ or ‘isolated mishap’ that” a prior Supreme Court case “excuses from the definition of cruel and unusual punishment,” the court wrote. “Thus, Lockett’s suffering did not run afoul of the Eighth Amendment.”

The judges ruled that Oklahoma was not “deliberately indifferent” in the execution.

“Simply put, the Eighth Amendment does not require ‘the avoidance of all risk of pain in carrying out executions.’”

After Lockett’s botched execution, Oklahoma was allowed to try again in another execution. The state used the wrong drug on an inmate, and his last words were that his body felt like it was on fire.

Months later, the state nearly made the same mistake again — a step that led a grand jury to begin investigating the state’s mistakes. This past year, the grand jury concluded that most corrections employees “profoundly misunderstood” what they were supposed to be doing during the lethal injection. “Although some [executioners] … were able to intelligently testify regarding the Protocol, the majority simply could not,” the report found.

The state’s attorney general, Scott Pruitt, said that some executioners were “careless, cavalier and in some circumstances dismissive of established procedures that were intended to guard against the very mistakes that occurred.” (Pruitt is now Trump’s nominee to run the Environmental Protection Agency.)

Years before these mistakes happened, Gorsuch was one of the judges who upheld the use of midazolam as an execution sedative, as well as Oklahoma’s execution procedures.

The inmates “have failed to establish that the use of midazolam in their executions, either because of its inherent characteristics or its possible negligent administration, creates a demonstrated risk of severe pain,” Judge Mary Briscoe wrote in an opinion that Gorsuch joined.

At that time, the drug midazolam had already been used in other botched executions, including a nearly two-hour execution in Arizona.

Oklahoma’s expert, Dr. Lee Evans, did not cite scholarly research, but instead relied on the website Drugs.com, which carries the disclaimer that it is “not intended for medical advice, diagnosis or treatment.”

The inmates’ attorneys alleged Evans made several mistakes in his testimony.

“Although plaintiffs point to what they perceive as a number of errors in Dr. Evans’ testimony,” the 10th Circuit judges wrote, “we conclude these errors were not sufficiently serious to render unreliable Dr. Evans’ testimony regarding the likely effect of a 500 milligram dose of midazolam, or to persuade us that the district court’s decision to admit Dr. Evans’ testimony amounted to an abuse of discretion.”

The US Supreme Court agreed in 2015.

Since then, there have been several problematic executions in which the drug has been used. In one Alabama execution, the inmate had his eyes open throughout the lethal injection. In another, the inmate heaved and coughed and clenched his fists.