A former dance instructor was sentenced to up to 40 years in prison for sexually assaulting four teenage girls, three of whom he had coached.

Jose Rivera-Vasquez, 41, pleaded guilty Thursday to 13 felonies in Lancaster County Court that involved the sexual abuse of the teen girls between 2011 and May 2015, according to the Lancaster County District Attorney’s office.

Before Judge Dennis Reineker sentenced Rivera-Vasquez, he wanted the defendant to apologize to the victims, two of whom were watching the hearing from the courtroom gallery.

After apologizing for years of abuse, Rivera-Vasquez was sentenced to 15 to 40 years in state prison. Once released, he will be a lifetime registrant under Megan’s Law.

In 2011, the defendant threatened to assault the 17-year-old victim, who was not one of his students, if she told anyone about the sexual abuse.

The three other victims, who were 13, 14 and 15 years old at the start of the abuse, were students in his dance classes. Rivera-Vasquez, who conducted his studio out of the attic of his home on South Ann Street, admitted to filming some of the abuse of the younger victims.