The U.S. Supreme Court in February refused to delay the execution of a death-row inmate in Alabama who was denied the right to have an imam with him at the time of his execution.

Correctional officials in Alabama had told the inmate, Domineque Ray, that he could have a Christian chaplain during his final moments but argued that allowing an imam to be present in the execution chamber would somehow present a security risk. Ray, who is Muslim, declined to have a representative of a faith that’s not his own with him and was executed with no religious leader present.

The high court was roundly criticized for the move, which to many observers looked like a clear case of religious favoritism. If a Christian minister could accompany an inmate to an execution chamber, why not an imam, a rabbi or a secular counselor?

The criticism might have had an effect. A virtually identical case reached the Supreme Court, and this time the outcome was different.

The court last week halted the execution of Patrick Murphy, a Buddhist who is on death row in Texas, because he was denied the right to have a Buddhist spiritual adviser with him.

What made the difference this time? The vote in Ray’s case was 5-4, reflecting a common conservative/liberal split on the court. In Murphy’s case, Justice Brett M. Kavanaugh switched sides and joined the liberal bloc, and it appears that Chief Justice John G. Roberts and Justice Samuel A. Alito did so as well.

Kavanaugh noted that correctional officials in Texas have a policy of allowing inmates facing execution who are Christians and Muslims to have religious leaders in the execution chamber. Therefore, he said, Texas could not deny the same right to a Buddhist.

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

The only reason the court gave for the different outcomes in the two cases was that it concluded that Ray’s request for a cleric of his own faith in the execution chamber was untimely, while Murphy’s was made in time. Ray’s request was made 15 days before his scheduled execution, while Murphy’s was made 28 days earlier. Does that 13-day difference really make a difference under the law?

Legal scholars are speculating that what actually led to a different result was that the court was stung by the barrage of criticism it received over Ray’s execution. Some have wondered if race and religion played a factor as well – Ray was African American and a Muslim; Murphy is white and a Buddhist.

But other observers believe the court simply realized it had made a mistake.

“A more likely reason, in my view, is that the justices saw the extremely negative reaction against their decision in Ray, and belatedly realized they had made a mistake; and not just any mistake, but one that inflicted real damage on their and the Court’s reputations,” Ilya Somin, a law professor at the Antonin Scalia Law School at George Mason University, wrote on the “Volokh Conspiracy” blog. “Presented with a chance to ‘correct’ their error and signal that they will not tolerate religious discrimination in death penalty administration, they were willing to bend over backwards to seize the opportunity, and not let it slip away.”

Members of the legal community will probably continue to speculate, but the fact is that we may never know what the led the Supreme Court to change course. But it’s good that a court majority did so. Government policies that give preferential treatment to Christianity, in the correctional context or in any other, fly in the face of the First Amendment.

If the government chooses to extend a benefit or privilege to one religious group, it must also give that same right to other religious groups and equivalent secular philosophies. The Supreme Court lost sight of that principle in Ray’s case. Here’s hoping it has corrected course.