A man who spent 21 years in prison for murder had his conviction overturned today - and says he lost decades behind bars because of a crooked cop.

Derrick Hamilton, 49, was imprisoned for supposedly murdering Nathaniel Cash in 1991, but has always been adamant he had nothing to do with it.

Instead, he says, he was locked up because former NYPD detective Louis Scarcella intimidated a woman into claiming she witnessed him shoot Cash dead.

Exonerated: Derrick Hamilton, 49, was wrongfully convicted of a 1991 murder - and has only now had formal recognition that he was innocent all along

Family: Hamilton, pictured above holding his daughter outside court in Brooklyn, said was paroled three years ago and got a job as a paralegal even before the exoneration

Cash’s girlfriend, Jewel Smith, told a court that she saw Hamilton kill her boyfriend, but later recanted.

A review of evidence in the case showed that Cash was shot in the back – while Smith’s testimony said he was hit in the chest. Ballistic analysis also showed that more than one gun had been fired, ABC7 reported.

Hamilton today held his young daughter in his arms as he spoke to reporters outside of a Brooklyn courthouse. He said: ‘One day in prison is too much for an innocent man. [Today is] exhilarating. It's a grateful day.’

He was paroled in 2011, and got a job as a paralegal, but was only formally cleared of the murder on Friday.

In 'Crooked cop': Hamilton, pictured above in court, says that former NYPD officer Louis Scarcella intimidated murder victim Nathaniel Cash's girlfriend into saying she saw him kill the victim

Joy: Hamilton, who said he is 'grateful' for the overturned conviction, hugged attorneys in court after the judge made his decision

Hamilton wore a baseball cap which said ‘wrongfully convicted’ on the front, and on the side said ‘victims of Detective Scarcella’.

He is the fourth man to be exonerated in an investigation Scarcella contributed to, the New York Daily News reported.

According to the News, Hamilton admitted he was ‘bitter’ about his years in jail, but said he is coming to terms with it. He added his first priority is to ‘party, party, party’.

However, lawyers for Detective Scarcella issued a blanket denial that he had done anything to wrongfully convict anybody during his policing career.

They said: ‘To date there has been no finding by any judge, nor has there been a statement by any prosecutor, to sustain the sensational claims that have appeared in the press that Detective Scarcella contributed to any person’s wrongful conviction’.