A New York City judge has tossed out a 1991 murder conviction against a man who says he was framed by a now-retired detective.

Derrick Hamilton had served 21 years in prison before being paroled in 2011. The decision on Friday cleared his conviction.

The 49-year-old Hamilton had always maintained his innocence in the shooting death of Nathaniel Cash. He told reporters after a court hearing in Brooklyn that he felt vindicated.

Cash's girlfriend testified against Hamilton. She later retracted her testimony.

The retired detective is at the center of several wrongful conviction claims.

Brooklyn District Attorney Kenneth Thompson is re-examining dozens of cases from the 1980s and 1990s. It's one of the nation's most ambitious efforts to determine whether old cases were handled properly.