KEW GARDENS, Queens — With the aid of video evidence, a private investigator helped a man be exonerated Thursday after he spent six months in jail for allegedly illegally selling a gun to a federal agent.

A judge in Queens absolved Wellington Clase on Thursday of any wrongdoing in the May 2013 sale of a gun to a Bureau of Alcohol, Tobacco, Firearms and Explosives official after Manuel Gomez, a private investigator, agreed to look into the case.

Clase was arrested in front of his wife and baby in August 2015 after an undercover officer wrongfully picked him out of a photo lineup, according to Gomez.

He then spent six months on Rikers Island before he was able to post bail —which had initially been set at $150,000 bail — on Jan. 29 of this year.

Clase was adamant of his innocence, and in an unusual twist, video evidence officials used to record the crime appears to have led to what freed him.

The man seen selling the gun in the video is not Clase — the two do not share a similar hairline, or eyebrow shape, Gomez points out.

Clase also has a distinguishing characteristic — a congenital eye condition that doesn't allow his left eyelid to fully open, a feature the man in the surveillance footage does not appear to have.

Investigators also failed to take finger prints or DNA off the illegal gun, according to the investigator.