Alabama may be violating the religious rights of a Muslim inmate set for execution by refusing to allow an imam at his death, a federal court said Wednesday in blocking the lethal injection.

The 11th US Circuit Court of Appeals granted an indefinite stay for Dominique Ray, 42, a day before he was scheduled to die for the slaying of a teenager more than two decades ago.

A three-judge panel of judges wrote that it was “exceedingly loath to substitute our judgment on prison procedures.” But, they added that it “looks substantially likely to us that Alabama has run afoul of the Establishment Clause of the First Amendment.”

The state said it would appeal.

The Alabama chapter of the Council on American-Islamic Relations said it supported Ray’s bid to have an Islamic leader present.

“We welcome this decision and hope Mr Ray will ultimately be provided equal access to spiritual guidance,” Ali Massoud, government affairs coordinator for CAIR-Alabama, said in a statement.

Alabama allows inmates to visit with their spiritual adviser before an execution, and they can have the adviser witness the execution from a room adjoining the execution chamber.

A Christian chaplain who works for the prison typically stays in the execution chamber, but Ray objected and asked for a Muslim cleric to be present.

The state agreed to remove the prison chaplain from the chamber but cited security reasons for why it would not allow an imam in the room.

The federal appeals court said the case merited review.

Ray was convicted in the fatal stabbing of a 15-year-old Tiffany Harville. Harville disappeared from her Selma home in July 1995. Her decomposing body was found in a field a month later.