Los Angeles (CNN) -- A former Los Angeles school district teacher pleaded no contest Friday to 23 felony counts of lewd acts on 23 children and was immediately sentenced to 25 years in prison, the district attorney's office said.
Mark Berndt, 62, who taught at Miramonte Elementary School for more than 30 years, was accused of putting pupils in bondage and then photographing them with semen-filled spoons held at their mouths and 3-inch cockroaches crawling across their faces. The incidents occurred between 2005 and 2010.
The sexual molestation victims were 22 girls and one boy between the ages of 7 and 10, prosecutors said.
Several tearful mothers of the victims attended Friday's emotional hearing.
Berndt's attorney, Manny Medrano, said his client could be released after serving 19½ years of the 25-year sentence. Berndt was arrested in 2012.
Appearing gaunt, Berndt entered the courtroom in an orange jail jumpsuit, handcuffed and chained at the waist. He responded directly to the judge and never turned around to face the gallery. Parents wept when Berndt walked into the courtroom.
His attorney, however, did turn to the gallery when speaking in court and said Berndt was profoundly sorry and remorseful for the pain and discomfort he caused.
In statements to the courts, the mothers told the judge that their daughters can never eat cookies again. Mothers earlier alleged that Berndt also gave their daughters cookies with a white substance on them.
Last year, in an interview with CNN, the mother of a female student said her daughter went to Berndt's classroom, where "he would give her some cookies. My daughter told me that the teacher would say the cookies had sugar and some white stuff that was on it," the mother said.
"He deserves to be punished," one mother said in her statement to the court. "Back in the day, you burned them in wood."
Responded Los Angeles County Superior Court Judge George G. Lomeli: "I don't have the power to do that nor would I."
In one written statement that was read aloud by a court employee, one mother of a victim defended Berndt as a "good man" and a "good teacher."
In September, the Los Angeles Unifed School District announced it paid almost $27.3 million to settle 58 of 191 students' lawsuits alleging they were victims of sexually lewd acts by Berndt. Meanwhile, two other lawsuits in the Miramonte case have been settled but are pending court approval. The almost $27.3 million in payments works out to about $470,000 per child, according to the district.
On Friday, Superintendent John Deasy said the district wasn't a party to the "plea deal."
"We are relieved that the students and families will be able to put this part of the proceedings behind them," Deasy said in a statement. "We hope that we can reach a resolution with the students and families who have yet to settle in an expeditious and respectful manner that will allow them to continue to heal and move forward."
CNN's Linda Hall and Jaqueline Hurtado contributed to this report.