The U.S. Supreme Court halted the execution of a Texas inmate on Thursday night because the state refused to allow his Buddhist spiritual adviser into the death chamber.

Justice Brett Kavanaugh said Texas policy is that death-row prisoners can have Christian or Muslim religious advisers in the execution room or the viewing area, but that advisers from other denominations are restricted to the viewing room.

That, he said, is discrimination—and he issued a stay of execution for Patrick Murphy, who was sentenced to death for the murder of a police officer killed during a robbery he took part in after escaping from prison.

“I knew there was a thin thread of possibility,” Murphy said with a smile after getting the news, according to the Associated Press.

Kavanaugh wrote that Texas has two choices: It can relegate all religious advisers to the viewing area, or it can let Murphy’s Buddhist adviser into the execution chamber.

“What the state may not do, in my view, is allow Christian or Muslim inmates but not Buddhist inmates to have a religious adviser of their religion in the execution room,” he said in his order. Justices Neil Gorsuch and Clarence Thomas voted against stopping the execution.

Kavanaugh went on to note that Murphy had asked to have the Rev. Hui-Yong Shih present in a timely manner, making his request a month ago. That was apparently to draw a distinction between this case and an earlier case in which the court declined to stop the execution of a Muslim prisoner in Alabama who wanted his imam in the room; in that instance, the court ruled that the condemned man had waited too long to raise the issue.

Murphy, 57, is a member of the so-called Texas 7 who escaped from prison in 2000 and went on a spree of robberies—shooting Irving, Texas, police officer Aubrey Hawkins 11 times.

In another appeal, Murphy argued that since he was a getaway driver in that robbery and didn’t actually fire a gun, he should not be put to death for Hawkins’ murder.

As a result of Thursday’s decision, Murphy will be returned to death row. The Texas Department of Criminal Justice said it is reviewing the ruling to determine next steps.