Ali said Hernandez had shaved off his mustache and cut his hair in an attempt to alter his appearance after wanted posters publicized his image.

Police and school district officials say Hernandez arrived at Sanchez Elementary School in the Castro on June 3 and told staffers he was bringing lunch to the 8-year-old girl. Less than five minutes later, according to Ali, a staffer who had noticed Hernandez acting suspiciously followed him into a secluded stairwell and allegedly discovered him molesting the girl.

"By all indications, he was a trusted individual," Ali said. "But thanks to the school employee, who was acting on her gut instinct that something was wrong, this crime was discontinued and we now have him in custody."