ATMORE, Ala. (AP) — The U.S. Supreme Court ruled Thursday night that Alabama can execute a man convicted of killing a police officer two decades ago, dismissing his claims that the state’s lethal injection procedure is cruel and unusual punishment.

Just minutes before 40-year-old Torrey Twane McNabb was scheduled to be put to death, the justices halted his execution. But about two hours later, they ruled it could move forward.

This undated photo released by the Alabama Department of Corrections shows Alabama inmate Torrey Twane McNabb, (r) who was convicted in the 1997 shooting death of Montgomery police Officer Anderson Gordon (r) two decades ago. The Alabama attorney general’s office plans to ask justices to lift a stay blocking the Thursday, Oct. 19, 2017, scheduled execution of 40-year-old McNabb. (Alabama Department of Corrections via AP)

McNabb is scheduled to be executed Thursday evening.

McNabb was convicted in the 1997 shooting death of Montgomery police Officer Anderson Gordon. Prosecutors say McNabb was fleeing a bail bondsman when he walked up and shot Gordon five times while the officer was sitting in his parked patrol car.

McNabb and several other inmates have challenged the state’s use of midazolam at the start of lethal injections, arguing that it violates Eighth Amendment protections against cruel and unusual punishment because the sedative would not reliably render them unconscious before other drugs stopped their lungs and heart.

A lawyer for McNabb has argued that it would be wrong to carry out the execution while proceedings continue in McNabb’s lawsuit.

The attorney general’s office asked the justices to let the execution proceed. The state has argued they have allowed multiple executions to proceed using the sedative midazolam and that McNabb presents “nothing new” to justify halting the execution.

“Alabama has already carried out four executions using this protocol. Three of those executed inmates were co-plaintiffs in this case,” the attorney general’s office wrote in a court filing.