A former Maryland music teacher pleaded guilty to possession of child pornography in a Baltimore County courtroom Thursday, clearing the way for his transfer to Montgomery County, where he is accused of sexually abusing 14 elementary school students and raping a middle school girl.

Lawrence W. Joynes, 55, was sentenced to nearly a year in jail, which amounts to the time he has served since his arrest in February 2013. Authorities said he could be released to Montgomery almost immediately and could make his first court appearance there Friday or Monday.

The investigation of Joynes stemmed from a federal probe of online distribution of child pornography, which by early 2013 led federal agents to Joynes, a resident of Dundalk, Md. The agents alerted local authorities, searched his home and found images on his computer, according to court records.

At the time, Joynes was teaching at New Hampshire Estates Elementary School in Silver Spring, which has students from pre-kindergarten through second grade. Police ultimately alleged that Joynes had sexually abused 14 students there. According to charging documents, Joynes asked students to come to his classroom during the lunch hour, coaxed them to suck on his finger or peppermint sticks, and video-recorded what they were doing.

Police also heard from a former student at Eastern Middle School in Silver Spring, where Joynes worked in the early 1990s. The former student alleged that Joynes abused her when she was a seventh-grader, including fondling her and having sexual intercourse with her, according to arrest records. He was charged with second-degree rape, child abuse and three counts of sex offense in that case.

Lawrence Joynes (Baltimore County Police)

Baltimore County prosecutor Lisa Dever said the pornography case was important because it led authorities to the more serious allegations in Montgomery. “It was the first step of a process that really began to shed light on what he was doing,” Dever said.

Parents reacted with alarm and frustration last year to news of Joynes’s arrest, worried that their children might have been harmed during his many years in the school system. He had worked for a decade at New Hampshire Estates and had taught at 10 other Montgomery public schools, including Eastern Middle, Francis Scott Key Middle and Cannon Road Elementary, during a 27-year career. Joynes is no longer employed by the school system.

At community meetings after his arrest, Montgomery school leaders said they had no prior indication that Joynes had acted criminally with students or taken pictures of them. But schools officials had been keeping an eye on him before the criminal charges.

A principal at New Hampshire Estates restricted Joynes’s access to students in 2011 after at least two reports of inappropriate conduct, according to court documents. Joynes was told, for instance, not to be alone with students in his classroom and to stay off the playground during recess. But court documents allege that Joynes instructed a kindergartner to act in sexually suggestive ways and video-recorded the student while the restrictions were in place.

Amid concerns raised by the Joynes case, schools officials said they would improve the tracking of reports of inappropriate conduct and provide additional training to principals.

At Thursday’s hearing, Baltimore County Circuit Judge Robert E. Cahill Jr. sentenced Joynes for a single count of possession of child pornography after Joynes quietly answered questions and declined to address the court. Because the sentence was for time served, he could be released from jail almost immediately. But he will be transferred into the custody of Montgomery authorities and taken to the county jail, Montgomery Sheriff Darren M. Popkin said.

The Montgomery state’s attorney’s office continues to investigate Joynes, spokesman Ramon Korionoff said.