BAKERSFIELD, Calif. (KGET) — A former Bakersfield elementary school teacher has pleaded no contest to a felony in connection with sending inappropriate messages to underage former students, according to court records.

Kyle Puette, 38, pleaded no contest Tuesday to a charge of exhibiting harmful matter to a minor, records say. A second charge of exhibiting harmful matter and six counts of contacting a minor with the intent to commit a sex act were dismissed.

“We were able to reach a resolution that really, from all perspectives, addressed the facts,” said Puette’s attorney, Kyle J. Humphrey.

He said Puette is remorseful and understands he needs treatment and cooperated with the investigation from the beginning.

Puette is scheduled to be sentenced April 13. He faces 16 months in prison and will have to register as a sex offender for life.

Puette taught at Louise Sandrini Elementary School from 2013 to 2017. He was arrested April 29 in Valley Center in San Diego County, where he was employed at Valley Center Elementary School.

The older sister of a former student told investigators she discovered Puette had been sending “nasty” messages to her sister through Instagram, according to court filings. She said she secretly recorded a Facetime chat where Puette, although clothed, was moaning and “clearly masturbating,” the filings say.

A second alleged victim said she believed Puette had been leaving presents on her doorstep, the documents say.

Humphrey said there was misconduct with only one victim.

The documents contain transcripts of chats Puette is accused of having with the girls. Investigators said Puette made repeated references in one thread to masturbating, even after asking one girl her age and acknowledging “ohh (sic) you’re too young,” according to the filings.