NEW YORK (AP) — Until recently, New York City police secretly kept fingerprints of children arrested as juveniles on file permanently in a department database. It’s an illegal practice that raised alarms about the lengths the nation’s largest police force has taken to keep tabs on the city’s youth.

The Legal Aid Society uncovered the years-long practice. The public defender organization pressured the police department to acknowledge it and threatened legal action to make it stop, citing a state law barring local police from stockpiling juveniles’ fingerprints.

Now, after years of wrangling and resistance, the NYPD said Wednesday it has purged all juvenile fingerprints records from the database and will no longer keep them indefinitely.

The Legal Aid Society said the database contained the fingerprints of tens of thousands of New York City youths.