A former high school teacher will spend seven years on probation, surrender his teaching certificate and undergo alcohol and sex offender counseling after pleading guilty Tuesday to child endangerment in a case in which he was accused of "sexting" a male student.

Murrysville police charged Terrence Flaherty, 58, of Penn Hills, with sending 64 text messages to the Franklin Regional High School student over four days in November, including requests for explicit photos of the boy and offering to forgive a debt if the boy participated in group sex.

Mr. Flaherty retired from teaching social studies at the school effective Jan. 20.