A California middle school music teacher was arrested on Friday on the suspicion of having a three-year-long sexual relationship with a student and then blackmailing the victim with nude photographs, authorities said.

Samuel Neipp, 34, started the relationship while the middle school student was 13 and it continued for three years, police said.

Authorities found out about the alleged relationship after Neipp allegedly threatened to post nude photos of the victim. The alleged threat prompted an investigation by San Jose Police Department’s Internet Crimes Against Children and Child Exploitation Detail.

It is unclear whether the student or someone else reported Neipp to authorities.

“Neipp used his position of authority to exploit the victim into a sexual relationship,” a statement issued by the police said.

Neipp was detained on Friday and is being held in Santa Clara County Jail without bail on suspicion of sexual acts with a minor under 14, oral copulation, blackmail and for possessing child pornography, the Mercury News reported.

The Associated Press contributed to this report.