A social studies teacher at Alden High School who sent sexual instant messages to a student pleaded guilty this week, Erie County District Attorney Frank A. Sedita III said Friday.

Gerald Wild II, 46, pleaded guilty Thursday to endangering the welfare of a child. As a condition of Wild’s plea before Alden Village Justice Robert Woods, Wild agreed to surrender his state teaching certificate.

Wild admitted to sending instant messages to a 16-year-old student between December 2011 and June 2012, Sedita said.

Erie County Sheriff’s investigators received a tip in June about an improper relationship between the student and teacher, and sheriff’s deputies searched Wild’s Amherst home in June, Senior Detective James Hatch said.

Forensic investigators analyzed an iPod in Wild’s home and determined he had sent inappropriate messages to the student, Hatch said, declining to say whether the student was male or female.

“It’s a betrayal of trust,” Hatch said. “The parents of this student were outraged. I work cases involving people dealing with juveniles all the time, and the most troubling ones are when a person of trust betrays that with someone they are supposed to be nurturing or protecting.”

Wild will be sentenced at 5 p.m. on March 25 in Alden Village Court. He faces a maximum prison term of one year.

“He’s accepted responsibility and complied with the terms of the plea agreement,” said Wild’s attorney, Joseph LaTona.