A music teacher is being held on $50,000 cash bail on child rape charges after he allegedly impregnated a 14-year-old student, prosecutors said.

Joshua Garsteck, 32, of Haverhill, pleaded not guilty Monday in Haverhill District Court. If he posts bail, he must be confined to his home, have no contact with the girl or any minors, and not use the Internet. Garsteck also must waive his privacy rights and allow his cellphone and computer to be searched, said Carrie Kimball Monahan, a spokeswoman for the Essex district attorney’s office.

Garsteck is due back in court Nov. 5 for a probable cause hearing, Kimball Monahan said.

Advertisement - Continue Reading Below

During the arraignment, a prosecutor read numerous text messages between Garsteck and the student, which revealed the nature of their relationship, Kimball Monahan said.

If convicted, Garsteck would face a mandatory minimum sentence of 10 years in prison and up to life in prison, Kimball Monahan said.

Police began investigating in May when the state Department of Children and Families was notified that the teenager was several months pregnant, Kimball Monahan said.

The investigation found that Garsteck was having a sexual relationship with the student, Kimball Monahan said.

She confirmed that Garsteck taught at the DeAngelis Studio of Music in Haverhill.