The US Supreme Court has been criticised after it blocked the execution of a Buddhist prisoner who claimed he has been refused the support of a spiritual adviser, weeks after rejecting the same argument from a Muslim inmate.

Patrick Murphy, a member of the “Texas 7” gang which killed a prison officer during an armed robbery two decades ago, was scheduled to be put to death by lethal injection on Thursday evening.

But the execution of the 57-year-old, who converted to Buddhism 10 years ago, was dramatically halted two hours before he was due to die, after the Supreme Court accepted an argument that his constitutional right to freedom of religion had been violated because prison officials refused to let his spiritual adviser be present in the death chamber.

Among those who supported the arguments of Murphy’s lawyers was the court’s newest justice, Brett Kavanaugh, who was sworn in last autumn after a controversial confirmation process.

He said the Texas prison system permitted a Christian or Muslim inmate to have an adviser either present in the execution chamber or in the adjoining viewing room. In contrast, inmates of other religions were only allowed an adviser in the viewing room, not the execution chamber itself.

Death row in California's San Quentin prison Show all 8 1 /8 Death row in California's San Quentin prison Death row in California's San Quentin prison A condemned inmate exercises in a cage out in the yard of San Quentin prison Getty Death row in California's San Quentin prison San Quentin State Prison opened in 1852 and is California's oldest penitentiary. The facility houses the state's only death row for men that currently has 700 condemned inmates Getty Death row in California's San Quentin prison The lethal injection facility at San Quentin prison AP Death row in California's San Quentin prison A condemned inmate stands in a cell out in the yard of San Quentin prison Getty Death row in California's San Quentin prison An armrest in the interior of the lethal injection facility at San Quentin prison AP Death row in California's San Quentin prison A cell on death row in San Quentin Getty Death row in California's San Quentin prison A cage on death row in San Quentin Getty Death row in California's San Quentin prison A cell on death row in San Quentin Getty

“As this court has repeatedly held, governmental discrimination against religion – in particular, discrimination against religious persons, religious organisations, and religious speech – violates the constitution,” he wrote, according to the Associated Press.

“The government may not discriminate against religion generally or against particular religious denominations.”

The court’s decision created confusion and some condemnation. Last month, it rejected an appeal from a Muslim death row inmate in Alabama to stop his execution because officials refused to allow him to have his Islamic spiritual adviser present in the execution chamber.

Dominique Ray also argued his religious rights were violated because Alabama allowed a Christian chaplain employed by the prison to be in the execution chamber. The court rejected his appeal, citing the fact it had only been lodged the previous month, and the 42-year-old’s execution went ahead.

“This is good news, but we can’t forget this is the same court that denied a Muslim man the same right just last month,” the American Civil Liberties Union (ACLU) said on Twitter. “The only real difference between Domineque Ray’s and Patrick Murphy’s requests to have clergy members of their own faiths at their executions is that Ray is a Muslim and Murphy is not. The Supreme Court’s divergent rulings once again suggest that Muslims are not treated equally.”

Support free-thinking journalism and attend Independent events

Murphy was among a group of inmates who escaped from a Texas prison in 2000 and proceeded to commit numerous robberies, including the one in which they shot and killed a 29-year-old police officer, Aubrey Hawkins.

The escaped inmates were arrested a month later in Colorado, ending a six-week manhunt. One killed himself as officers closed in, and the six others were convicted of killing the police officer and sentenced to death.

Murphy would have been the fifth to be executed. The sixth inmate, Randy Halprin, has not been given an execution date.

Texas Department of Criminal Justice spokesman Jeremy Desel said the state would review the ruling to determine how to proceed. He said Murphy would be returned from the Huntsville unit prison, where executions are carried out, to the Polunsky unit, about 72km (45 miles) to the east, where death row inmates are imprisoned.