PASADENA, Calif. (AP) — A federal appeals court has overturned the conviction and death penalty of a man for three San Diego murders, saying he was denied a chance to argue the trial was tainted by racial prejudice.

The 9th U.S. Circuit Court of Appeals on Friday ordered Hector Ayala freed unless prosecutors plan to retry him in a reasonable amount of time.

The killings occurred during a 1985 robbery. At trial, the prosecution excused all seven black and Hispanic jurors who might have served.

Ayala's counsel challenged those rejections but the judge found they were based on "race-neutral" reasons.

The appeals court said some of the prosecution's reasons seemed implausible but Ayala's lawyer wasn't allowed to hear them until after trial. It said Ayala was thus denied a chance to argue racial bias.