A man who spent 20 years on Ohio's death row before his sentence was overturned has agreed to a plea deal that will give him his freedom, his attorney said Wednesday.

Ken Richey, a U.S. and British citizen, will enter a plea Thursday and return to his native Scotland on Friday, attorney Ken Parsigian told The Lima News in a story reported on its Web site.

Richey was convicted of murder 20 years ago in a fire that killed a 2-year-old girl. Prosecutors said Richey set the blaze to get even with his former girlfriend, who lived in the same apartment building as the toddler.

A federal appeals court ruled in August that Richey's former lawyer mishandled his case and ordered prosecutors to try Richey again or release him.

The state had been set to try him again in March.

Instead, he will plead no contest to attempted involuntary manslaughter, child endangering and breaking and entering, and be sentenced to time already served, Parsigian said. A no contest plea is not an admission of guilt but a statement that no defense will be presented. It is treated like a guilty plea by courts.

Richey has drawn support from members of the British Parliament and the late Pope John Paul II.

He was nearly out of appeals until the 6th U.S. Circuit Court of Appeals court ordered a new trial. The court said expert testimony could have contended that the fire wasn't intentionally set.

"This case epitomizes what is wrong with the capital punishment system," said Clive Stafford Smith, legal director for British legal charity Reprieve who has assisted with Richey's legal representation for more than 15 years. "An innocent man gets a death sentence because he had an incompetent lawyer at trial, his conviction is reversed two decades later, and then he has to enter a plea to avoid a second death sentence. It was the right thing to do — nobody can expect him to trust a system that already got it so terribly wrong — but it's an insane process nevertheless."