SAN FRANCISCO (CBS SF) – A man pleaded guilty Monday to sexually assaulting his 8-year-old step-granddaughter at her school in San Francisco’s Mission District last year, a spokesman for the district attorney’s office said Tuesday.

Pedro Hernandez, 69, agreed to serve 12 years in state prison in a plea deal with prosecutors, district attorney’s spokesman Seth Steward said.

READ MORE: UPDATE: Atmospheric River Crashes Onshore; Flood Warning Issued For Napa, Sonoma Counties

Hernandez pleaded guilty to one count of continuous sexual abuse of a minor following his arrest in June in connection with the sexual assault of the girl on at least three separate occasions at Sanchez Elementary School, police and prosecutors said.

On June 3, a teacher’s aide at the school became suspicious of Hernandez’s behavior toward the girl after he arrived to bring her lunch around noon, police said.

She later caught Hernandez assaulting the girl in a secluded stairwell on campus and called police. The sexual assault was recorded on the school’s video surveillance system, according to police.

READ MORE: UPDATE: Streets Flood in San Rafael, Mill Valley as Wild Storm Lashes Bay Area

Hernandez left before officers arrived but was arrested a week later at a homeless shelter in San Bruno.

Prosecutors said Hernandez, who collected recyclables for a living, had been staying with the girl’s family at the time of the assaults.

He originally pleaded not guilty to seven felony counts, including sexual intercourse or sodomy with a child, and oral copulation or sexual penetration with a child, and faced a maximum sentence of life in prison before agreeing to the plea deal on Monday, prosecutors said.

Hernandez is scheduled to be formally sentenced on April 12.

MORE NEWS: Stephen Curry Reaches 5,000 Assists, Warriors Beat Kings 119-107

(Copyright 2011 by CBS San Francisco. All Rights Reserved. This material may not be published, broadcast, rewritten, or redistributed. Wire services may have contributed to this report.)