Duane Buck, an inmate on Texas's death row for the past 16 years, has been spared the lethal injection after the US supreme court stayed his execution on the grounds that the jury at his sentencing hearing was told he was a danger to the public because he is black.

The fact it took the highest court in the nation to prevent the judicial killing of a prisoner in such controversial circumstances will put the governor of Texas, Rick Perry, further under the spotlight. He was earlier approached by lawyers of Buck and exhorted to use his power to put a 30-day reprieve on the execution to give time for all parties to look at his case, but Perry did not act.

Perry, a frontrunner for the Republican nomination for next year's presidential election, has presided over 235 executions since he became governor in 2000, the most recent on Tuesday. Last week he defended his record during a televised debate at which the Republican audience cheered when the number of those who had died under him was mentioned. Perry was in Iowa fundraising for his presidential campaign at the time the execution was due to have taken place.

Buck, 48, killed his former girlfriend and a man in 1995. His guilt is not in dispute, but the fashion in which he received the death penalty is. The jury that gave him the punishment was told by a psychologist, under prosecution cross-examination, that black people posed a greater risk to violent reoffending if released from jail.

The evidence of the psychologist, Dr Walter Quijano, was recognised as a legal problem by Texas's then attorney general John Cornyn in 2000. Six other cases in which Quijano had given racially tinged testimony were identified and all were awarded a resentencing hearing. On legal technicalities, Buck has been awarded no such safeguard.

The intervention of the US supreme court gives the prisoner one last chance to plead for commutation of his sentence to life imprisonment.

When Buck was informed that he was to live, at least for a little while longer, he said: "Praise the Lord. God is worthy to be praised. God's mercy triumphs over judgment. I feel good."

Kate Black, Buck's lawyer, welcomed the court's decision: "We are relieved that the US supreme court recognised the obvious injustice of allowing a defendant's race to factor into sentencing decisions and granted a stay of execution to Duane Buck," she said.

"No one should be put to death based on the colour of his or her skin. We are confident that the court will agree that our client is entitled to a fair sentencing hearing that is untainted by considerations of his race."

The issue of the death penalty is by no means at an end in Texas, however. The state executes more people each year than any other state in the US, and has two executions scheduled for next week.