Washington (CNN) -- A sharply divided Supreme Court ruled against a former death row inmate who sought damages from the state after prosecutors hid crucial blood tests that would have earlier proven his innocence. The 5-4 decision Tuesday involved John Thompson, who came within weeks of execution and had spent 18 years behind bars before being set free after the new forensic evidence came to light.

At issue was whether a district attorney's office should be held liable, under a "failure to train" standard, when one of its prosecutors unconstitutionally withholds exculpatory evidence from a criminal defendant.

Then-New Orleans area District Attorney Harry Connick Sr. claimed his office should not be held fully responsible after one of his staff attorneys violated long-standing, accepted procedures on handling evidence in criminal trials.

Thompson's lawyers said the DA's office as a whole should be held liable for the poor training of prosecutors working under Connick.

"A district attorney is entitled to rely on prosecutors' professional training and ethical obligations in the absence of specific reason, such as a pattern of violations, to believe that those tools are insufficient," Justice Clarence Thomas said. He was supported by his conservative colleagues Chief Justice John Roberts and Justices Antonin Scalia, Anthony Kennedy and Samuel Alito.

In a tough dissent, Ruth Bader Ginsburg said "Connick's deliberately indifferent attitude created a tinderbox in which (constitutional) violations were nigh inevitable."

But Thomas noted prosecutors often face "gray areas," discretionary judgment calls concerning what evidence may be important to the defense.

"To prove deliberate indifference, Thompson needed to show that Connick was on notice that, absent additional specified training, it was 'highly predictable' that the prosecutors in his office would be confounded by those gray areas and make incorrect ... decisions as a result," he said. "In fact, Thompson had to show that it was so predictable that failing to train the prosecutors amounted to conscious disregard for defendants' (constitutional) rights. He did not do so."

Thompson was convicted in 1985 in the murder of a New Orleans man. He was also implicated in a separate attempted armed robbery. Blood tests at the robbery showed the perpetrator had blood type B.

Lawyers at the Orleans Parish DA's office offered conflicting stories about whether the prosecuting attorney ever received the blood test report, or whether Thompson himself was ever given a confirming blood test.

Thompson was eventually convicted of both crimes and received the death sentence for the murder.

Just weeks before his scheduled 1999 lethal injection, private investigators hired by Thompson's lawyers discovered the original crime lab report in police files. The prisoner was then tested and found to have blood type O.

A hidden crime scene report also uncovered years after the fact showed eyewitnesses describing the murderer as 6 feet tall with close-cropped hair. Thompson had a large Afro at the time, and was only 5 feet, 8 inches. That report too was not handed over to the defense at trial.

Armed with the new evidence, state courts then reversed the murder conviction, concluding the armed robbery conviction unfairly deprived Thompson of his right to testify in own defense at the murder trial.

After being retried for murder in 2003, a jury found Thompson not guilty and he was released from custody.

A federal civil rights lawsuit was then filed and a jury awarded Thompson $14 million in damages, a judgment upheld by a federal appeals court.

A landmark 1963 high court ruling -- Brady v. Maryland -- said prosecutor have a sworn duty to turn over evidence that may show a defendant is innocent. But in a subsequent opinion, the high court said individual prosecutors cannot be sued for any constitutional violations in the courtroom.

The Thompson decision further limits when defendants can sue for so-called "Brady" violations.

In a rare oral dissent, Ginsburg spoke from the bench to strongly criticize the majority's conclusions.

"The record in this case abundantly shows flagrant indifference to Thompson's rights," she said. "The conceded, long-concealed prosecutorial transgressions in Thompson's trials were neither isolated nor atypical. They were just what one would expect given the attitude toward Brady pervasive in the district attorney's office."