A Montgomery County judge sentenced former elementary school music teacher Lawrence W. Joynes to 40 years in prison on Friday for sexually abusing 14 young children. (CORRECTION: A previous version of the caption on this video listed the wrong name for the man who was sentenced. This version has been corrected.) (WUSA9)

A former Montgomery County music teacher was sentenced to 40 years in prison on Friday for sexually abusing 14 young children at an elementary school.

At the hearing, Lawrence W. Joynes spoke publicly about his actions for the first time and described himself as ashamed, frightened and remorseful.

“I’m so sorry I betrayed your faith and your trust in me,” said Joynes, a 27-year veteran of the public school system, addressing his former students in a statement. “I never, ever meant to harm any of you physically or emotionally. For any damage, any shame, any trauma that I’ve caused, I apologize from the depths of my soul.”

A teacher at 11 schools over his lengthy county career, Joynes pleaded guilty in May to sexually abusing students at New Hampshire Estates Elementary in Silver Spring, where he placed girls in sexual poses and made video recordings of them — movies he edited with sexually explicit captions, according to police and prosecutors.

Lawrence Joynes (Baltimore County Police)

Many of the offenses took place during school hours in his music classroom over an eight-year period before his arrest in 2013 and involved children in kindergarten to second grade.

Montgomery Circuit Court Judge Joseph M. Quirk said the 56-year-old Joynes would serve a minimum of 20 years before being eligible for parole related to the 14 counts.

Joynes also faces a separate sentencing this fall involving another abuse victim, who was a student at Eastern Middle School in Silver Spring in the 1990s. Prosecutors will seek more prison time.

“For the 14 victims, the emotional and psychological scars you caused will probably require many years of professional attention and efforts to heal,” Quirk said, noting that some children, “but certainly not all,” may have been “mercifully spared serious injury because young memories did not preserve your pernicious invasions into their lives.”

“This all occurred in what most people would consider the safest of settings: a school, with a long-standing teacher, in a field of beauty, a field of music,” Quirk said.

Assistant Montgomery County State’s Attorney Timothy F. Hagan Jr. said that Joynes’s misconduct was not limited to suggestive videos.

Although there is no evidence Joynes had the elementary school children undress, Hagan said in court, “there is absolutely no doubt that he had sexually inappropriate contact with many of these children. Some, he did not. Or at least we don’t have evidence.”

Hagan said that Joynes had traded in child pornography — he pleaded guilty last year to a charge of possession of child pornography — but that law enforcement officials found no evidence of him doing so with the Montgomery students.

“I can’t say that it didn’t happen,” he said. The captions that Joynes wrote to go with the images of the children seemed designed for an audience larger than himself, Hagan said.

“I guess it’s possible it’s only for his benefit, but it’s not written in that way,” he said.

Hagan said that Joynes “knew exactly what he was doing” and is “a masterful manipulator,” and he questioned an account, given by Joynes, about his experiencing sexual abuse as a child.

He said the allegations had not come up during lengthy interviews with police when Joynes spoke openly about his conduct.

“He grooms children to sexually abuse them,” he said. That’s what he does. “That’s what he used his position for — and it lasted for years in the schools.”

One victim’s father spoke before the court, describing the impact on his daughter and family. “The wound he caused us — we will never be cured, definitely,” he said, speaking in Spanish through an interpreter.

The father questioned why victims would have to bear the costs for any problems in Joynes’s childhood.

“Why? Is it because we are Latinos?” he asked, saying that many of the children Joynes abused are Latino.

Hagan also read a written statement from a victim, in which the girl said the abuse made her feel “dirty, messed up” and “not the same as other girls my age.”

She said she has had a hard time sleeping, which results in headaches, and feels that she must protect her younger brothers and sisters from “something like this happening to them.”

She said she also has a hard time asking for help at school because she feels scared to stay alone with teachers.

“I don’t trust teachers,” she said.

The girl said that she goes to therapy and that her mother blamed herself “for putting me in that school.” She said that when her mother found out about the abuse, she was pregnant and “it made her cry a lot and she didn’t eat much.”

“I still hear her cry,” she said. “It makes everyone in my family very sad.”

Joynes’s attorney, Mary K. Siegfried, said that Joynes believes he has a good side. The early years of his life were troubled, she said.

He recalled being sexually abused and beaten as a child and was told that he was worthless. He was severely injured when he was 10 when he was hit by a dump truck. His father was a police officer, and a sister described their father as “an angry drunk,” Siegfried said.

In his statement to the court, Joynes said he turned to drugs and alcohol most of his life, trying to cope with the abuse he endured. “I’m a flawed, flawed man,” he said.