A divided US supreme court blocked the execution of an Alabama inmate to let a lower court review claims that strokes and dementia had left him incompetent to understand his death sentence.

The 11th US circuit court of appeals halted the execution seven hours before Vernon Madison, 65, was scheduled to die by lethal injection at a state prison in Atmore on Thursday night.

The Alabama attorney general’s office responded with an emergency motion to the US supreme court asking it to let the execution proceed before the death warrant expired at midnight. But a divided 4-4 court on Thursday evening maintained the stay ordered by an appellate court.

Madison was convicted in the 1985 killing of Julius Schulte, a Mobile policeman. Schulte had responded to a domestic call involving Madison. Prosecutors said Madison crept up and shot Schulte in the back of the head as he sat in his police car.

Attorneys for the Equal Justice Initiative have argued multiple strokes and dementia have left Madison frequently confused, disoriented and unable to understand his pending execution. They said he has an IQ of 72, can no longer walk independently and at one point talked of moving to Florida because he believed he was going to be released from prison.

“Mr Madison suffers from dementia, has no independent recollection of the offence he was convicted of and consequently does not have a rational understanding of why the state of Alabama is attempting to execute him,” attorneys with EJI wrote in the stay request.

The US supreme court has ruled, in cases involving inmates with mental illness, that condemned inmates must possess a “rational understanding” that they are about to be executed and why, but left it to lower courts to sort out what that means in individual cases.

The appellate court said it would hear oral arguments about Madison’s competency in June.