NEW YORK CITY — The NYPD kept an illegal database of children’s fingertips for years which was only confirmed to be destroyed this week, according to the Legal Aid Society.

The fingerprints of tens of thousands of young New Yorkers — many of whom were never found guilty of a crime — were not destroyed by police as state law mandates they must, Legal Aid attorneys said Wednesday.

“This illegal database existed for years,” said Legal Aid’s juvenile rights attorney Dawne Mitchell, “infringing on young New Yorkers’ rights, in clear violation of the law.”

Legal Aid began investigating the possible existence of the databank in 2014 when a city prosecutor admitted a child was arrested based on fingerprints unlawfully kept by the NYPD, the attorneys said.

The New York State Family Court Act specifies that children can only be fingerprinted in under certain circumstances and that police must destroy those fingerprints after passing them along to the state.

In 2015, Legal Aid openly accused the NYPD of holding onto records in a demand letter requesting the department destroy the fingerprints or face prosecution, the group said.

The NYPD denied Legal Aid’s claims an NYPD spokesperson Det. Sophia Mason, responding to news outlets’ request for comment Wednesday, said police destroy juvenile delinquent fingerprints.

Months of back-and-forth between Legal Aid, the NYPD and the New York State Division of Criminal Justice Services finally resulted in the NYPD inadvertently acknowledging police kept juvenile fingerprints in its Automated Fingerprint Identification System, the group said.

Legal Aid began investigating the possible existence of the databank in 2014 when a city prosecutor admitted a child was arrested based on fingerprints unlawfully kept by the NYPD, the attorneys said.

The New York State Family Court Act specifies that children can only be fingerprinted in under certain circumstances and that police must destroy those fingerprints after passing them along to the state.

In 2015, Legal Aid openly accused the NYPD of holding onto records in a demand letter requesting the department destroy the fingerprints or face prosecution, the group said.

The NYPD denied Legal Aid’s claims an NYPD spokesperson Det. Sophia Mason, responding to news outlets’ request for comment Wednesday, said police destroy juvenile delinquent fingerprints.

Months of back-and-forth between Legal Aid, the NYPD and the New York State Division of Criminal Justice Services finally resulted in the NYPD inadvertently acknowledging police kept juvenile fingerprints in its Automated Fingerprint Identification System, the group said.