WORCESTER – Former Boy Scout leader Andrew J. Myers was supposed to guide and teach young men, but instead, prosecutors said, the Northbridge man preyed on young boys and solicited sex from students he knew from substitute teaching.

The 34-year-old suspended lawyer pleaded guilty in federal court Wednesday to enticing and attempting to entice minors for sex and possession of child pornography. His sentencing is scheduled for Sept. 9.

A former Northbridge School Committee member and substitute teacher in the Northbridge Middle School system, Mr. Myers now faces 15 to 21 years in federal prison, according to a plea agreement filed in the case. A federal judge would have to accept the plea agreement.

The case against the former local Boy Scout leader unfolded in July 2012 when a Colorado mother discovered email and Skype communications between her 12-year-old son and a man eventually identified as Mr. Myers.

The conversations involved discussions of sex acts and attempts by Mr. Myers to have the boy display sexual acts over the Internet, Assistant U.S. Attorney Mark Grady detailed in U.S. District Court in Worcester.

Officials from the Larimer County, Colo., sheriff's office contacted police in Northbridge police about the conversations on Skype, an online streaming service.

Before reading the allegations, Mr. Grady warned the judge that the details in the case were very descriptive. After all of the accusations were detailed Mr. Myers had one statement.

"I do not contest what has been said today," Mr. Myers responded to U.S. District Court Judge Timothy S. Hillman.

During his conversations with the 12-year-old Colorado boy, Mr. Myers talked about returning from a scout camp trip. He makes lewd comments about the boys.

"I just wish some of them were willing to let me play along," Mr. Myers said after making sexual comments about the children.

Mr. Myers looked down eventually as Mr. Grady continued with the details in federal court. His voice got soft when he uttered "guilty" to the charges.

Mr. Grady said computers seized in the case led to the discovery of an online communication with a South Carolina teenage boy that discussed and displayed sex acts, Mr. Grady said. Equipment was seized from his law office at 70 Church St., Whitinsville, and from his parent's home at 92 Tracey Drive, Whitinsville, where he lived and was arrested last year.

There were online messages sent to three teenage boys – all minors – from Mr. Myers including soliciting sexual acts, Mr. Grady said. The messages, sent last year, were to boys from Northbridge and Millbury schools. Mr. Myers knew the boys through his substitute teaching, Mr. Grady said.

To one teen, Mr. Myers expressed lust for the minor and that any sexual encounter could be discreet. Investigators found a slew of child pornography on Mr. Myers' computers along with numerous clothed pictures of minor males personally known to him, authorities said. At least one picture was of a boy from Central Massachusetts.

Mr. Myers, who is in federal custody served, on the Northbridge School Committee from 2005 to 2008. In 2004, he ran for state representative in the 9th Worcester District. He had earned the rank of Eagle Scout in the 1990s.

The Mohegan Council of the Boy Scouts of America removed Mr. Myers' membership and terminated him as scoutmaster after the accusations were revealed.