A judge has freed a man convicted in the 1990 killing of a Brooklyn rabbi.

David Ranta’s murder conviction was vacated on Thursday with the support of prosecutors.

Rabbi Chaskel Werzberger was shot on Feb. 8, 1990, by a man fleeing a botched robbery. Thousands attended the funeral for the Hasidic rabbi.

A recent review by the Brooklyn district attorney’s office cast doubt on witness testimony and concluded detectives had mishandled aspects of the investigation.

The 58-year Ranta has been serving time in a Buffalo prison.

Ranta’s 11 family members cried and gasped when his conviction was vacated.

“I just want to get him in my hands and I’ll be happy,” said his son, David Ranta Jr., 36, who last saw his dad about 6 years ago.

The younger Ranta was joined in court today by his daughter Priscilla, 25.

Ranta’s original trial lawyer, Michael Baum, who attended hearing, said beforehand, “I haven’t talked to him because I didn’t want to give him hope. I’m looking forward to seeing today after a long time.

It’s an amazing feeling. To have a client who you know to be innocent, to have be exonerated, it’s truly a beautiful thing.”