A Dorchester man who spent 22 years in prison after being convicted of killing a Boston police officer says he's grateful he will receive a new trial.

The Massachusetts Supreme Judicial Court on Friday affirmed an earlier decision by a lower court granting Sean Ellis a fourth trial in the murder of Detective John Mulligan.

Ellis, 42, says he cried when he heard the new and is looking forward to his new trial

"I didn't commit this crime and I believe I have the representation that is needed to finally prove that," Ellis said.

Ellis was 19 years old in 1993 when he was arrested on charges that he killed Boston Police Detective John Mulligan.

Police say Mulligan was asleep in his car while working a security detail outside a Walgreens in Roslindale when he was shot five times in the face at close range.

Ellis was tried three times in 1995 for the murder. The first two trials ended with a hung jury. Ellis was convicted in the third trial and sentenced to life in prison.

Last year, Suffolk Superior Court Judge Carol Ball ruled that exculpatory evidence was withheld from the jury, ordered a fourth trial, and released Ellis on bail after he had served 22 years behind bars.

The Supreme Judicial Court on Friday upheld that decision, agreeing that Ellis did not get a fair trial because detectives who played key roles in the murder investigation later pleaded guilty to corruption charges.

"Officers that were directly involved in Sean's case served federal time, officers who were directly involved in the corruption scheme with the alleged victim in this case, Detective Mulligan," Ellis' attorney, Rosemary Scapicchio, said Friday. "That's the issue here."

Scapicchio says evidence of the detectives' corruption would have been forceful in front of a jury. She expects a full investigation will extend beyond Ellis' case.

"I'm calling on the governor, I'm calling on the the attorney general's office, I'm calling the U.S. attorney's office to launch an investigation into the policies, procedures and the convictions that came out of the Boston homicide unit in the late 1980s and early '90s, because there is something wrong," Scapicchio said. "Sean is not alone."

Ellis says he's thankful for the decision that came when he says the right questions were asked.

"Not just the right questions, but hard questions to get to the truth," he said. "I am thankful for that."

The Suffolk County district attorney's office says prosecutors will retry Ellis, arguing that there's been no reliable evidence presented that undercuts its original case.