The Los Angeles school district agreed to pay $139 million to families of students who were subjected to sexual abuse by an elementary school teacher who took bondage-style pictures of several of his students, according to school officials on Friday.

The Los Angeles Unified School District and the legal representatives of the families in the case settled all litigation, where jury members were being selected in the teacher's upcoming trial. Previously, the school district had paid $30 million to settle many other related lawsuits.

"Throughout this case, we have shared in the pain felt by these children, their families and the community," Superintendent Ramon Cortines said in a statement.

The 63-year-old teacher, Mark Berndt, at the center of this litigation, pleaded no contest last year to 23 counts of lewd acts upon a child and was sentenced to 25 years in prison. These acts included taking photos of his young students tied in bondage, posed with semen-laced cookies held up to their faces, and restrained while cockroaches crawled on them, all of which investigators uncovered.

The third-grade teacher at Miramonte Elementary School was arrested for the abuse in January 2012, prompting protests from neighborhood parents over the treatment of their children.

"By every measure the community has healed and the school is doing well. This is really the final chapter in that whole odyssey," Dave Holmquist, general counsel for the Los Angeles Unified School District, said after the settlement was announced.

The new $139 million settlements and $30 million from previous agreements over Berndt's actions involve roughly 150 children who were his students from 2005 onward, according to a district spokesperson. Settling before the trial allows the child victims to avoid the emotional damage done by having to tell their story repeatedly in court and in police interviews.

A judge will determine how the settlement funds will be distributes among the families of nearly 80 children, depending on the level of abuse they suffered and how much therapy will likely be needed to emotionally deal with the trauma.