A Muslim inmate who was scheduled to be executed in Alabama on Thursday night for the rape and murder of a 15-year-old girl in the 1990s got a reprieve – for now – after a federal appeals court ruled the state may be violating his rights by refusing to let his imam into the death chamber with him.

The 11th U.S Circuit Court of Appeals granted the last-minute stay for Dominique Ray, 42, on Wednesday. Ray had objected to Alabama's practice of allowing a Christian prison chaplain, who is a prison system employee, to stand near the inmate during the lethal injection and to pray with the inmate if the inmate requests that.

"The central constitutional problem here is that the state has regularly placed a Christian cleric in the execution room to minister to the needs of Christian inmates, but has refused to provide the same benefit to a devout Muslim and all other non-Christians," the three-judge panel wrote.

The judges added that it "looks substantially likely to us that Alabama has run afoul of the Establishment Clause of the First Amendment."

PROSECUTORS TO SEEK DEATH PENALTY FOR ACCUSED COP KILLER IN OHIO

Ray had asked to bring in his imam to stand near him during the procedure but was told he could not because only prison employees were allowed in the execution chamber, according to the Associated Press.

The Alabama attorney general's office is still trying to push forward with the execution, asking the U.S. Supreme Court on Wednesday afternoon to vacate the stay and let the execution proceed Thursday night.

In its request, the office reiterated that Alabama does not allow non-prison system employees in the execution chamber, but agreed to remove the chaplain from the chamber during Ray's execution. An initial filing with the Supreme Court said the state had changed its procedure to accommodate the 11th Circuit order, but an amended filing did not include that language.

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.

The state says all inmates can visit with their own spiritual adviser before an execution and have them witness it -- but only from an adjoining room.

"Like any other inmate, Ray has been and will be given opportunities to speak with his spiritual adviser, including up to the moment that he is taken into the chamber," state attorneys wrote.

Robert Dunham, executive director of the Death Penalty Information Center, which studies capital punishment in the U.S., told the Associated Press that this is generally the procedure regarding spiritual advisers in other states as well.

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

Ray was convicted in 1999 after co-defendant Marcus Owden told police that they had picked the girl up for a night out on the town and then raped her. Owden, who pleaded guilty to murder and testified against Ray, said Ray cut the girl's throat.

GET THE FOX NEWS APP

Ray's legal team on Wednesday also asked the U.S. Supreme Court to stay the execution on other grounds.

They argued it was not disclosed to the defense team that records from a state psychiatric facility suggested Owden suffered from schizophrenia and delusions. Attorneys asked the Supreme Court to halt the execution to examine whether the state had a duty to find and produce the information.

The Associated Press contributed to this report.