BOSTON — Massachusetts' highest court on Wednesday reinstated the late Aaron Hernandez's murder conviction, which was erased after the former NFL star killed himself in prison.

The Supreme Judicial Court also scrapped the legal principle that wiped out Hernandez's conviction for future cases, calling it ''outdated and no longer consonant with the circumstances of contemporary life.''

Hernandez was convicted in 2015 of killing semi-professional football player Odin Lloyd. Two years later, the 27-year-old killed himself in his prison cell days after being acquitted of most charges in a separate double-murder case.

A judge threw out Hernandez's conviction that year, citing the legal principle that holds that a defendant convicted at trial who dies before an appeal is heard should no longer be considered guilty in the eyes of the law, thereby returning the case to its pretrial status.

Under the doctrine, rooted in centuries of English law, a conviction should not be considered final until an appeal can determine whether mistakes were made that deprived the defendant of a fair trial, legal experts say.

Prosecutors have said the legal doctrine is outdated and unfair to victims. Bristol County District Attorney Thomas Quinn II argued the defendant's estate should be allowed to appeal the case, if they wish. Otherwise, the conviction should stand, he said.

''He goes through a full trial, a jury who speaks for the public convicts him and because he dies, in this case commits suicide, the whole thing is wiped out like it never happened? It's not fair or just and should be changed,'' Quinn told reporters after the
November hearing.

Under the new rule laid out by the court, the conviction will stand but the court record will note the conviction was neither affirmed nor reversed because the defendant died while the appeal was pending.

Other high-profile Massachusetts criminals whose convictions have been erased after their deaths include John Salvi, who was convicted of killing two abortion clinic workers and wounding five other people during a shooting rampage in Brookline in 1994.

Roman Catholic priest John Geoghan, a key figure in the clergy sex abuse scandal that rocked the Boston archdiocese and spread across the globe, also had his child molestation conviction vacated after he was beaten to death in 2003 in his cell at the same Massachusetts maximum-security prison where Hernandez died.

Hernandez's attorney had previously argued the legal doctrine should remain intact, saying juries make mistakes.

How other states handle cases such as Hernandez's varies widely. Some states, like Massachusetts, toss the convictions, while others dismiss the defendant's appeal and the conviction stands. Other states allow appellate courts to consider a dead defendant's case, prosecutors say.