The chaplain was allowed to be present, the officials went on, because he was an employee of the prison system who was “a member of the execution team” and was “familiar with the technicalities of the execution protocol,” having attended almost every execution in the state since 1997. The chaplain kneels and prays with inmates who seek pastoral care, the officials said. After considering Mr. Ray’s request, prison officials agreed to exclude the chaplain. But they said allowing the imam to be present raised unacceptable safety concerns.

A unanimous three-judge panel of the United States Court of Appeals for the 11th Circuit, in Atlanta, stayed the execution, saying Mr. Ray had presented “a powerful Establishment Clause claim.”

“We are exceedingly loath to substitute our judgment on prison procedures for the determination of those officials charged with the formidable task of running a prison, let alone administering the death penalty in a controlled and secured manner,” Judge Stanley Marcus wrote. “Nevertheless, in the face of this limited record, it looks substantially likely to us that Alabama has run afoul of the Establishment Clause of the First Amendment.”

The appeals court put Mr. Ray’s appeal on a fast track, with briefing to have been completed in a little more than a month.

On Wednesday, lawyers for Alabama filed an emergency application asking the Supreme Court to vacate the stay of execution in the case, Dunn v. Ray, No. 18A815. The state should be allowed, they wrote, to proceed with the “serious and solemn responsibility” of conducting executions “in an orderly and secure fashion.”

In response, lawyers for Mr. Ray urged the justices to allow the litigation to move forward in the appeals court. “Mr. Ray does not dispute that the state has an interest in enforcing its judgments,” they wrote. “But it does not have an interest in doing so unconstitutionally.”

In her dissent on Thursday, Justice Kagan wrote that the majority had acted with unseemly haste.

“Ray has put forward a powerful claim that his religious rights will be violated at the moment the state puts him to death,” she wrote. “The 11th Circuit wanted to hear that claim in full. Instead, this court short-circuits that ordinary process — and itself rejects the claim with little briefing and no argument — just so the state can meet its preferred execution date.”