The Supreme Court on Thursday night stopped the execution of a Texas inmate because the state refused his request to have a Buddhist spiritual adviser with him in the death chamber.

The court’s decision contrasted with its actions last month, when it allowed the execution of a Muslim prisoner in Alabama who was denied his request to have an imam with him at the time of his death.

The court’s conservatives were criticized by liberals and religious conservatives for that decision. They said that the request came too late.

Texas officials had made the same argument about Patrick Murphy, who was part of a gang of escaped inmates who killed a suburban Dallas police officer during a Christmas Eve robbery more than 18 years ago.

But the Supreme Court’s order Thursday night said Texas could not execute Murphy “unless the state permits Murphy’s Buddhist spiritual advisor or another Buddhist reverend of the state’s choosing to accompany Murphy in the execution chamber during the execution.”

The court did not give a reason for its decision. Only Justices Clarence Thomas and Neil M. Gorsuch said they would have let the execution proceed.

Justice Brett M. Kavanaugh, writing only for himself, said Texas’s policy was discriminatory.

“The relevant Texas policy allows a Christian or Muslim inmate to have a state-employed Christian or Muslim religious adviser present either in the execution room or in the adjacent viewing room,” Kavanaugh wrote. “But inmates of other religious denominations — for example, Buddhist inmates such as Murphy — who want their religious adviser to be present can have the religious adviser present only in the viewing room and not in the execution room itself for their executions.

“In my view, the Constitution prohibits such denominational discrimination.”

That is the same argument Justice Elena Kagan made last month when she and the court’s liberals objected to the execution of Alabama inmate Domineque Ray.

Under Alabama’s policy, “a Christian prisoner may have a minister of his own faith accompany him into the execution chamber to say his last rites,” Kagan wrote.

“But if an inmate practices a different religion — whether Islam, Judaism, or any other — he may not die with a minister of his own faith by his side. That treatment goes against the Establishment Clause’s core principle of denominational neutrality.”

In Ray’s case, the court’s conservatives said he did make his request soon enough, although a lower court had put his execution on hold to hear his First Amendment arguments.

Kavanaugh added in a footnote that Murphy, who converted to Buddhism a decade ago, “made his request to the State in a sufficiently timely manner, one month before the scheduled execution.”

Texas officials and the U.S. Court of Appeals for the 5th Circuit had denied Murphy’s request, citing in part the court’s decision last month in the Ray case.

That late-night, two-paragraph order has become the court’s most controversial act of the term, drawing intense criticism from the political right and the left.

Murphy was one of the “Texas 7” gang that escaped from a South Texas prison in December 2000 and then committed numerous robberies, including the one in which they shot 29-year-old Irving police Officer Aubrey Hawkins 11 times, killing him.

Hawkins, who had been with the Irving police force about 14 months, had just finished Christmas Eve dinner with his family when he responded to the call about the robbery at a sporting goods store and was ambushed.

The escaped inmates were arrested a month later in Colorado. One of them killed himself, and the others were convicted of killing Hawkins and sentenced to death. Murphy would be the fifth to be executed.

The sixth inmate, Randy Halprin, has not been given an execution date.

The case is Murphy v. Collier.