He was the spitting image of the killer, had the same first name and was near the scene of the crime at the fateful hour: Carlos DeLunapaid the ultimate price and was executed in place of someone else in Texas in 1989, a report out Tuesday found.

Even “all the relatives of both Carloses mistook them,” and DeLuna was sentenced to death and executed based only on eyewitness accounts despite a range of signs he was not a guilty man, said law professor James Liebman.

ADVERTISEMENT

Liebman and five of his students at Columbia School of Law spent almost five years poring over details of a case that he says is “emblematic” of legal system failure.

DeLuna, 27, was put to death after “a very incomplete investigation. No question that the investigation is a failure,” Liebman said.

The report’s authors found “numerous missteps, missed clues and missed opportunities that let authorities prosecute Carlos DeLuna for the crime of murder, despite evidence not only that he did not commit the crime but that another individual, Carlos Hernandez, did,” the 780-page investigation found.

The report, entitled “Los Tocayos Carlos: Anatomy of a Wrongful Execution,” traces the facts surrounding the February 1983 murder of Wanda Lopez, a single mother who was stabbed in the gas station where she worked in a quiet corner of the Texas coastal city of Corpus Christi.

“Everything went wrong in this case,” Liebman said.

ADVERTISEMENT

That night Lopez called police for help twice to protect her from an individual with a switchblade.

“They could have saved her, they said ‘we made this arrest immediately’ to overcome the embarrassment,” Liebman said.

Forty minutes after the crime Carlos DeLuna was arrested not far from the gas station.

ADVERTISEMENT

He was identified by only one eyewitness who saw a Hispanic male running from the gas station. But DeLuna had just shaved and was wearing a white dress shirt — unlike the killer, who an eyewitness said had a mustache and was wearing a grey flannel shirt.

Even though witnesses accounts were contradictory — the killer was seen fleeing towards the north, while DeLuna was caught in the east — DeLuna was arrested.

ADVERTISEMENT

“I didn’t do it, but I know who did,” DeLuna said at the time, saying that he saw Carlos Hernandez entering the service station.

DeLuna said he ran from police because he was on parole and had been drinking.

Hernandez, known for using a blade in his attacks, was later jailed for murdering a woman with the same knife. But in the trial, the lead prosecutor told the jury that Hernandez was nothing but a “phantom” of DeLuna’s imagination.

ADVERTISEMENT

DeLuna’s budget attorney even said that it was probable that Carlos Hernandez never existed.

However in 1986 a local newspaper published a photograph of Hernandez in an article on the DeLuna case, Liebman said.

Following hasty trial DeLuna was executed by lethal injection in 1989.

Up to the day he died in prison of cirrhosis of the liver, Hernandez repeatedly admitted to murdering Wanda Lopez, Liebman said.

ADVERTISEMENT

“Unfortunately, the flaws in the system that wrongfully convicted and executed DeLuna — faulty eyewitness testimony, shoddy legal representation and prosecutorial misconduct — continue to send innocent men to their death today,” read a statement that accompanies the report.