By Elisabeth Smith

SACRAMENTO (CBS13) — A Sacramento teacher is in prison for attempting to lure a child into a sexual relationship.

Taylor Lewis Gholar, 29, was sentenced to three years in state prison Thursday. He will also be required to register as a sex offender for life.

According to court records, Gholar met the victim when she was in second grade. He was working as her after-school teacher. When the victim was 12, Gholar sent direct messages to her over Instagram, asking her if she wanted to have sex, requesting provocative pictures of her and sending her a pornographic photo of himself.

Once the victim’s parents became aware of the conversation, court records reveal that police and the victim’s parents communicated with Gholar on social media, pretending to be the child.

While posing as the child, police arranged to meet with Gholar in West Sacramento for the purpose of having sexual intercourse. He was arrested on January 20, and police say they found condoms during the arrest.

The Sacramento City Unified School District said Gholar previously worked at Oak Ridge Elementary School in 2016. In a statement, the district said they are cooperating with the investigation.

More from CBS Sacramento: