A man executed by Alabama on Thursday night heaved and coughed for 13 minutes before dying, and critics of capital punishment said his reaction was caused by a drug that should be banned because it does not render a prisoner sufficiently unconscious.

Alabama used sedative midazolam in its lethal injection mix to execute 45-year-old Ronald Smith. Midazolam, a valium-like drug, has been used in executions in Ohio, Oklahoma, and Arizona that took longer than usual or were botched. In some instances, witnesses said convicted murderers twisted on gurneys before dying.

The drug has also been used in executions in Florida.

Thirty-one U.S. states allow the death penalty.

"It shows there is a clear and ongoing risk that prisoners who are executed in a multi-drug protocol using midazolam are going to be exposed to searing pain during the course of the execution," said Robert Dunham, executive director of the non-profit Death Penalty Information Center, which examines issues regarding U.S. capital punishment.

Smith, convicted of murdering a convenience store clerk in 1994, underwent two consciousness tests to make sure he could not feel pain, media witness Kent Faulk wrote for the news website al.com.

Smith was also seen moving his lips after the drugs were administered in the execution, which took 34 minutes, Faulk wrote.

Critics have contended that the drug does not achieve the level of unconsciousness required for surgery and is therefore unsuitable for executions. Supporters have said it is an effective chemical, the use of which has been authorized by the U.S. Supreme Court.

In a 5-4 ruling in June 2015 in support of midazolam, Justice Samuel Alito wrote that death row inmates in Oklahoma challenging its use had, among other things, failed to show there was an alternative method of execution available that would be less painful.

The inmates failed to demonstrate that "any risk of harm was substantial when compared to a known and available alternative method of execution," Alito said.

In Alabama and other states, midazolam is typically used in combination with a drug that halts breathing and another that stops the heart.

States have been looking for drugs for lethal injections after a number of drugmakers, mostly European, began banning sales of their products for use in executions over ethical concerns.

This year, U.S. pharmaceutical company Pfizer Inc. halted sales of its products for use in executions over similar concerns. This includes midazolam, pancuronium bromide, which can be used as a paralytic agent that halts breathing, and potassium chloride, which can cause cardiac arrest.

(Writing and additional reporting by Jon Herskovitz)