The Supreme Court on Monday decided that Oklahoma may continue the use of the controversial sedative midazolam for lethal injections — even after the drug was linked to several botched executions in 2014.

The Supreme Court case dealt with the botched execution of Clayton Lockett in Oklahoma. The Lockett execution, which took 43 minutes after experimental lethal injection drugs were administered, led four inmates — one of whom was executed before the Supreme Court decided the issue — to file a lawsuit challenging Oklahoma's lethal injection protocol. The Supreme Court ultimately decided the botched execution, along with other evidence, wasn't adequate proof that midazolam was cruel and unusual punishment.

But Oklahoma didn't always use midazolam for executions. The use of the controversial sedative is actually a response to an ongoing lethal injection drug shortage, which has left the future of the death penalty unclear in Utah, Oklahoma, Tennessee, and the 29 other states where executions are legal, and added a new angle to the perennial debate about the morality and effectiveness of capital punishment.

European pharmaceutical companies are making it really hard to get lethal injection drugs

Over the past few years, a shortage of sodium thiopental, a key drug in lethal injections, has left states scrambling for alternative ways to execute prisoners and has inspired some to shroud the process in secrecy.

The shortage began around 2010, when drug suppliers around the world, including in the US, began refusing to supply drugs for the injections — out of either opposition to the death penalty or concerns about having their products associated with executions.

"The drugs were being cut off right and left," Deborah Denno, a death penalty expert at Fordham University, said.

"The drugs were being cut off right and left"

Hospira Inc. was the sole US supplier of sodium thiopental, according to Denno. But Hospira stopped producing the drug in 2011, after struggling to procure active ingredients for its production and fielding legal threats from authorities in Italy, where the death penalty is vehemently opposed.

Some states still managed to import sodium thiopental from shadier overseas sources. But beginning in 2012, the US District Court of the District of Columbia issued several rulings banning imports of the drugs, deciding that the imported supplies didn't meet FDA regulations.

As the shortage continued, states turned to other European companies for alternative drugs, such as phenobarbital and propofol, that are typically used as sedatives for surgeries. But these companies — under pressure from a European Union export ban, activists like Reprieve, and foreign governments that prohibit the death penalty — over time refused to supply the drugs.

As these companies either stopped supplying drugs or were unable to export to the US, states began to look for new — and sometimes untested — ways to execute prisoners.

Loosely regulated compounding pharmacies made up for the shortage

With pharmaceutical companies out of the picture, states resorted to compounding pharmacies to make the drugs, which until now escaped most regulations since they did small, mostly out-of-sight transactions with individuals, not major customers. The US-based pharmacies began to produce experimental, sometimes secretive cocktails for states' executions.

Compounding pharmacies were originally meant to make custom drugs for individual people, not major buyers like state governments, Denno said. As a result, their drug cocktails can often be very shoddy — Georgia stopped an execution because its lethal injection drug was "cloudy" — and have been decried as experimental and dangerous by civil rights groups such as the American Civil Liberties Union.

But even compounding pharmacies may soon stop providing execution drugs to states. The International Academy of Compounding Pharmacists on March 24 announced that it "discourages its members from participating in the preparation, dispensing, or distribution of compounded medications for use in legally authorized executions."

Producing lethal injection drugs "is only going to invite further scrutiny"

The stance may be a way for compounding pharmacies, which are largely unregulated, to avoid the extra regulatory scrutiny that can come with producing lethal injection drugs. "These compounding pharmacies already have enough of a [public relations] issue," Denno said. Massachusetts, for instance, in 2014 passed a law cracking down on compounding pharmacies after a local company's drugs were implicated in the deaths of more than 60 people. Producing lethal injection drugs, Denno said, "is only going to invite further scrutiny."

But instead of stepping up regulations, some death penalty states have adopted measures to shield compounding pharmacies that provide lethal drugs from outside scrutiny.

In December, Ohio passed a law that will keep suppliers of lethal drug injections anonymous. John Murphy, executive director of the Ohio Prosecuting Attorneys Association, which supports the law, said last December that the changes are not meant to make the execution process more secretive. "This just protects the identity of the people involved so they don't get harassed, intimidated, or attacked," he said.

Several states botched executions in the past year

The drug shortage hasn't only led to concerns about market forces, regulations, and supply and demand. It's also raised important constitutional questions about cruel and unusual punishment, as the shortage has led some states to try experimental and unpredictable drugs for executions.

Since 2014, there have been several high-profile botched executions — described in gruesome detail in the press — all of which have involved secretive, experimental uses of midazolam.

Here are some of the cases:

Dennis McGuire, Ohio: McGuire took 26 minutes to die after the state used a mixture of hydromorphone and midazolam, according to the New York Times's Erica Goode. McGuire gasped and snorted before he died.

Clayton Lockett, Oklahoma: Lockett struggled violently and groaned after the state injected a combination of midazolam, vecuronium bromide, and potassium chloride, the Guardian's Katie Fretland reported. State officials halted the execution, but Lockett died 43 minutes after the drugs were injected.

Joseph Wood, Arizona: Wood took nearly two hours to die after the state used a mixture of hydromorphone and midazolam, according to the Guardian's Tom Dart. Wood, who gasped and gulped before he died, was injected with 15 times the amounts called for in the state's execution protocol by the time he was pronounced dead.

These botched executions drew criticism and put an unwanted spotlight on the use of experimental lethal drugs, which critics say is a violation of constitutional protections against cruel and unusual punishment. Some states, including Ohio and Oklahoma, have delayed further executions as they review their practices.

Denno expects these problems to continue as states struggle to replace superior drugs like sodium thiopental. "Every time a state changes to a new drug, it introduces a degree of uncertainty," Denno said. "These drugs aren't the first choice."

Untested drugs are dangerous, but botched executions aren't new

Botched executions have been around as long the death penalty. About 7 percent of lethal injections and 3 percent of all executions between 1890 and 2010 were botched, according to Austin Sarat's Gruesome Spectacles.

Part of the reason states began using lethal injection drugs is because the previously preferred method of execution for many states, electrocution, often had horrifying results, including the eruption of burned flesh and even live fires as prisoners gasped for air and slowly died.

"We have really incompetent people doing this"

But lethal injections carry problems beyond the drugs used for the procedures that may make them even more prone to being bungled. For one, most doctors — who are likely the most qualified to administer the deadly drugs — won't participate in executions because administering a deadly drug to kill someone would violate professional ethics. In 2010, the American Board of Anesthesiologists voted to revoke the certification of any member who participates in executing a prisoner.

As a result, states aren't typically able to bring in the best-trained doctors, particularly anesthesiologists, to administer drugs that are very dangerous when mishandled. "We have really incompetent people doing this," Denno said.

Perhaps as a result, lethal injection has always been one of the riskier forms of execution — even before the drug shortage forced states to experiment with alternative substances.

In Oklahoma, the doctor and paramedic who participated in Clayton Lockett's botched execution said they received no training, the AP's Sean Murphy reported. The execution team administered needles that weren't long enough for the procedure, and caused what a state official called a "bloody mess" when the doctor tried to set an IV line in Lockett's groin and blood gushed out.

In addition to physically botching an execution, it's always possible the state will execute an innocent person. An April 2014 study published in PNAS, a scientific journal, suggested that at least 4 percent of people sentenced to death in the US are likely innocent. At least six people were exonerated of death sentences in 2014, according to a January report from the National Registry of Exonerations.

States are looking for other ways to execute people

So far, Denno of Fordham University has tracked three states that are moving toward alternatives to lethal injection should they run out of drugs. Tennessee reinstated the possibility of the electric chair, Utah has allowed the firing squad again, and Oklahoma has permitted nitrogen gas.

These methods of executions were largely abandoned 50 years ago. After the Supreme Court forced states in 1972 to reform their execution procedures to be less racially discriminatory, states began mostly using lethal injections, as this fantastic chart posted by John West at Quartz shows:

States could potentially seek out different drugs to continue using lethal injections and avoid execution methods that are widely seen as more gruesome. But states are also likely wary of repeating the same problems they've experienced with the current batch of drugs. "The same thing is going to happen," Denno said. "This has been a cycle: every time states have tried to do it, they've been cut off."

But many of the methods of execution that don't involve injected drugs have major problems.

Denno predicted gas executions will likely turn into "a disaster." She said gas has the same issues as lethal injection drugs: it's unclear where states would get the chemicals required for the executions, and whatever chemicals are used may not be suitable for a quick, relatively painless death. It also recalls ghastly memories of World War II, when the Nazis used gas chambers to kill prisoners in death camps.

The firing squad is "the quickest, the surest, and you have trained executioners to do it"

Electrocution and hanging were abandoned in the first place because they often resulted in botched executions. Electrocutions caused burned skin or live fires during multiple executions, and hangings could go very wrong when the rope broke or the prisoner was decapitated. Both can also take longer than 10 minutes to kill a prisoner.

Denno argued the firing squad may turn out to be the most humane of the available options, even above lethal injections. "It's the quickest, the surest, and you have trained executioners to do it," she said.

Dunham, executive director of the Death Penalty Information Center said states are dealing with the reality that there's no humane way of killing someone. "All the methods of execution have problems," Dunham said. "The involuntary termination of another person's life by execution is an inherently violent act."

Of course, states may be able to come up with another method entirely — or repeal the death penalty altogether. But at least for now, states appear to be sticking to the traditional ways of executing prisoners.

Why the death penalty persists

Capital punishment persists through drug shortages and botched executions because it still has strong public support in the US, which puts pressure on lawmakers to find alternatives to lethal injection drugs rather than abolishing the death penalty in the 32 states where it's still legal.

America's support for the death penalty stands in sharp contrast with Europe, where only Belarus, a pro-Moscow dictatorship, still allows capital punishment.

An October 2014 Gallup poll found 63 percent of Americans support the death penalty, while 33 percent oppose it.

Support for the death penalty gets a little more complicated when Americans are asked about specific methods of execution. An NBC News poll from May 2014 found nearly two-thirds of voters support alternatives to lethal injection if the needle isn't an option. But most US adults told YouGov in a February 2015 survey that the gas chamber, electric chair, firing squad, hanging, and beheading are cruel and unusual punishment, while lethal injection isn't.

Support for the death penalty also varies from state to state. Executions are much more culturally and legally ingrained in the South and, to a lesser extent, the West than in the rest of the country. Eighteen states have abolished the death penalty, most of which are in the Northeast and Midwest, according to the Death Penalty Information Center.

So while popular support generally pressures lawmakers to find alternatives to lethal injections, that's not necessarily true in all parts of the country, and most US adults don't appear to support all methods of execution.

Regardless of what lawmakers do, the number of executions has been dropping for years. A report from the Death Penalty Information Center found the number of executions hit a 20-year low in 2014.

But even if that's the case, the death penalty as a whole remains very popular and culturally ingrained in the US — and that's led states to seek alternatives like experimental drugs, the firing squad, and nitrogen gas rather than abolishing executions altogether.