A former teacher at The Academy of the Holy Family in Sprague, accused of sending inappropriate text messages to a 14-year-old student, has accepted a plea deal that will let him avoid prison.

Robert Pfeiffer, 31, of Hebron, agreed Tuesday to plead no contest to a charge of risk of injury to a minor and accept a fully suspended sentence of five years in prison plus five years’ probation.

The no contest plea means Pfeiffer does not admit guilt, but agrees to accept punishment.

Pfeiffer is scheduled to be sentenced June 25.

The plea deal comes the week before Pfeiffer was scheduled to go on trial in New London Superior Court in front of Judge Arthur Hadden. A jury already has been chosen, and evidence was supposed to be given starting Monday.

If he had been convicted by a jury, Pfeiffer would have faced a maximum sentence of 10 years in prison and a $10,000 fine.

Pfeiffer was arrested a year ago. He was accused of sending inappropriate text messages in 2010 to the student at the all-girl Catholic high school. He was not accused of having sexual contact with her.

The investigation began in April 2010, according to an affidavit for an arrest warrant. Sister Loreto Beckstein, the school principal, told police that Pfeiffer said he had been texting a student. He learned that another student was going to report the situation and decided to tell Beckstein first.

Pfeiffer told the principal he was texting hypothetical scenarios to ensure the student would be able to say no to boys in the future.

The girl, a freshman boarding student, said she viewed Pfeiffer as a father figure and confided in him about family problems, police said. She told Beckstein that she knew many of the texts referred to sexual topics, police said, even though she didn’t understand certain terms.

The girl said that later Pfeiffer “freaked her out by saying creepy things about sex, telling her that there is a spot behind the church where they could do it,” police said.

Police said they were unable to obtain any of the text messages either on Pfeiffer’s or the girl’s cellphones before they were deleted. This would have forced the prosecution at his trial to rely on witnesses’ 3-year-old memories of what the messages said.