The appellate court says Perri was "mentally incompetent" at the time.

A man convicted of fondling the feet of young girls at Pittsford and Penfield libraries is getting a new trial.

Anthony Perri was sentenced to 21 years in prison in 2013.

A state appellate court overturned his conviction. They ruled that a lower court made a mistake in allowing prosecutors to use portions of Perri's videotaped statement to police before he was read his Miranda rights and also by allowing portions of Perri's grand jury testimony during his criminal trial.

The appellate court says Perri was "mentally incompetent" at the time.