Thirteen minutes into his execution by injection, an Alabama inmate heaved and coughed and appeared to move during tests meant to determine consciousness.

Ronald Bert Smith Jr., 45, was finally pronounced dead at 11:05 p.m. Thursday night — about 30 minutes after the procedure began at the state prison in southwest Alabama.

Alabama uses the sedative midazolam as the first drug in a three-drug lethal injection combination. Smith and other inmates argued in a court case that the drug was an unreliable sedative and could cause them to feel pain, citing its use in problematic executions. The U.S. Supreme Court has upheld the use of the drug.

Smith was convicted of capital murder in the Nov. 8, 1994, fatal shooting of Huntsville store clerk Casey Wilson. A jury voted 7-5 to recommend a sentence of life imprisonment, but a judge overrode that recommendation and sentenced Smith to death.

At the beginning of his execution, Smith heaved and coughed repeatedly, clenching his fists and raising his head.

A prison guard performed two consciousness checks before the final two lethal drugs were administered. In a consciousness test, a prison officer says the inmate's name, brushes his eyelashes and then pinches his left arm. During the first one, Smith moved his arm. He slightly raised his right arm again after the second consciousness test.

The meaning of those movements will likely be debated. One of Smith's attorneys whispered to another attorney, "He's reacting," and pointed out the inmate's repeated movements.

Alabama Department of Corrections via AP

This undated photo provided by the Alabama Department of Corrections shows Ronald Bert Smith Jr. Smith was sentenced to be executed for the 1994 slaying of Huntsville store clerk Casey Wilson.

This undated photo provided by the Alabama Department of Corrections shows Ronald Bert Smith Jr. Smith was sentenced to be executed for the 1994 slaying of Huntsville store clerk Casey Wilson.

(Alabama Department of Corrections via AP)

The state prison commissioner said he did not see any reaction to the consciousness tests.

"We do know we followed our protocol. We are absolutely convinced of that," Alabama Corrections Commissioner Jeff Dunn said Thursday evening.

When asked if the movements indicated the state's process should be changed, Dunn said: "There will be an autopsy that will be done on Mr. Smith and if there were any irregularities those will hopefully be shown or born out in the autopsy. I think the question is probably better left to the medical experts."

Alabama's execution recalled memories of a botched 2014 execution in Oklahoma. In that execution, inmate Clayton Lockett writhed on the gurney, moaned and pulled up from his restraints after being administered the state's three-drug execution protocol. Execution team members considered trying to save his life and took Lockett to an emergency room before he finally died, 43 minutes after his initial injection.

Just before Thursday night's execution began, Smith replied, "No ma'am" when asked by the prison warden if he had any final words. A member of Wilson's family, who was not identified, witnessed the execution. The victim's family did not make a statement.

Wilson was pistol-whipped and then shot in the head during the robbery, court documents show. Surveillance video showed Smith entering the store and recovering spent shell casings from the bathroom where Wilson was shot, according to the record.

In overriding the jury's recommendation at the 1995 trial, a judge likened the slaying to an execution, saying Wilson had already been pistol-whipped into submission and Smith ignored his pleas for mercy. Wilson had a newborn infant at the time of his death.

"The trial court described Smith's acts as 'an execution style slaying.' Tonight, justice was finally served," Alabama Attorney General Luther Strange said in a statement after the execution.

U.S. Supreme Court justices twice paused the execution as Smith's attorneys argued for a delay, saying a judge shouldn't have been able to impose the death penalty when a jury recommended he receive life imprisonment.

Four liberal justices said they would have halted the execution, but five were needed to do so.

Smith's attorneys had urged the nation's highest court to block the planned execution to review the judge's override.

Smith's lawyers argued a January decision that struck down Florida's death penalty structure because it gave too much power to judges raises legal questions about Alabama's process. In Alabama, a jury can recommend a sentence of life without parole, but a judge can override that recommendation to impose a death sentence. Alabama is the only state that allows judicial override, they argued.

"Alabama is alone among the states in allowing a judge to sentence someone to death based on judicial fact finding contrary to a jury's verdict," attorneys for Smith wrote Wednesday.

Lawyers for the state argued in a court filing Tuesday that the sentence was legally sound, and that it is appropriate for judges to make the sentencing decision.

Smith, the son of a NASA contract employee, became an Eagle Scout at 15, but his life spiraled downward because of alcoholism, according to a clemency request to Alabama's governor. He had a final meal of fried chicken and french fries and was visited during the day by his parents and son.

Alabama has been attempting to resume executions after a lull caused by a shortage of execution drugs and litigation over the drugs used.

The state executed Christopher Eugene Brooks in January for the 1993 rape and beating death of a woman. It was the state's first execution since 2013. Judges stayed two other executions that had been scheduled this year.