Nine of the UK's most senior judges have refused to ban the mandatory death penalty in Trinidad and Tobago.
The law dates back to when the country was a British colony.
The judges expressed concerns but said the nation's constitution meant they could not intervene.
A death sentence is a mandatory punishment for every person convicted of murder under Trinidad and Tobago's Offences Against The Person Act 1925.
The new ruling comes from the Judicial Committee of the Privy Council (JCPC) - UK Supreme Court justices who also rule on complicated legal questions from some former British colonies.
The JCPC is the final court of appeal for a number of Commonwealth nations and British overseas territories.
After Trinidad and Tobago became independent in 1962, its constitution stated that any existing law from the days of the British Empire would remain in force unless its parliament decided to remove or reform it.
In practice, this means that many of the country's laws, as with some other Commonwealth nations, are closely rooted in rules that were in place in the UK and across the Empire in the early 20th Century.
In a highly unusual case heard in London last November, lawyers for convicted murderer Jay Chandler argued that the mandatory death penalty he received under the 1925 law was unconstitutional.
They told the hearing in London that the wording of Trinidad and Tobago's constitution meant that a mandatory death penalty should be ruled to be a cruel and unusual punishment - and therefore banned.
In 2018, judges at the Caribbean Court of Justice, the senior court for many countries in the region, outlawed automatic death sentences in Barbados - adding pressure on Trinidad and Tobago to abandon the 1925 law.
But ruling today, Lord Hodge, one of the most senior judges on the JCPC and Supreme Court, said that it was not a question for judges in London - but for Trinidad and Tobago's parliament.
"The 1976 Constitution saves existing laws, including the mandatory death penalty, from constitutional challenge," said Lord Hodge.
"The consequence of that is that the state of Trinidad and Tobago has a statutory rule which mandates the position of a sentence, which will often be disproportionate and unjust.
"The sentence is recognised internationally as cruel and unusual punishment. The state does not dispute that characterisation."
He said that despite those concerns, the judges in London could not legitimately interfere as there was no constitutional law question for them to settle.
"It is striking that there remains on the statute book a provision which, as the government accepts, is a cruel and unusual punishment because it mandates the death penalty without regard to the degree of culpability," he said.
"Nonetheless, such a provision is not unconstitutional. The 1976 Constitution has allocated to parliament, as the democratic organ of government, the task of reforming and updating the law, including such laws."
The Death Penalty Project, a legal campaign group that represents Jay Chandler, said there were 45 people on death row in Trinidad and Tobago. It is not clear what their fate will now be. No-one has been sent to the gallows since 1999 amid huge delays to appeals.
Parvais Jabbar, the group's co-executive director, urged the country's parliament to re-examine the continued existence of historical laws that are out of step with the modern world.
He said: "Trinidad and Tobago remain the only country in the Commonwealth Caribbean to continue using a mandatory death penalty and it is imperative that the government now take the necessary measures to ensure that a punishment, that they themselves accept to be cruel and inhuman, is removed."
- THE 'MIND ROOM' THAT INSPIRED SUCCESS: The story behind AC Milan's innovative psychology lab
- WELLBEING THROUGH COOKERY: Could cooking therapy help your mental health?