WORCESTER — A former Boy Scout leader, substitute teacher and school instructional assistant was sentenced Monday afternoon in U.S. District Court to more than 18 years in federal prison for trying to entice children for sex and for possession of child pornography.

Andrew J. Myers, 34, of 92 Tracey Drive, in the Whitinsville section of Northbridge, was sentenced to 18 years and four months in prison on four counts of enticing and attempting to entice minors for sex and a concurrent 10-year sentence for child pornography, followed by 10 years of supervised release.

On June 12, Mr. Myers, who had been arrested in August 2012, withdrew his pleas of not guilty and pleaded guilty to all five counts.

U.S. District Judge Timothy S. Hillman, in setting the sentences Monday, said he could not ignore that Mr. Myers chose to be employed where he could solicit minors for sex. Three area boys, from Northbridge and Millbury schools, were among the children to whom he sent sexually suggestive online messages.

Before the sentencing Monday, the mother of "juvenile victim three" spoke on behalf of her 11-year-old son, as well as herself.

Reading her son's victim impact statement on how Mr. Myers took the adolescent's happy memory of a school trip and turned it into a bad one, the woman, turning to Mr. Myers, said, "You are a sick bastard. I trusted you as a teacher and a chaperone ... I hope you rot in prison."

Fighting to hold back tears, she said she felt that she had failed as a parent for having her son fall prey to a child predator on her watch and having to have conversations with her son that no mother should have.

"You stole something from him that can never be replaced," she said. "For that, I will never forgive you."

From 2009 to 2012, Mr. Myers volunteered as a Scoutmaster for Boy Scout Troop 155 in Whitinsville and Troop 171 in Dudley.

Mr. Myers was a substitute teacher for Bancroft School in Worcester from November 2009 to October 2011 and was an instructional assistant at the Raymond E. Shaw Elementary School in Millbury until the end of the 2011-12 school year.

Mr. Myers worked as a summer camp instructor at the elementary school in Millbury in August 2012 and was terminated by the school department on Aug. 21, 2012, after his arrest.

The case against the former 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 sex acts over the Internet, Assistant U.S. Attorney Mark J. Grady said in court.

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. There were also online messages sent to the three local boys, all underage, from Mr. Myers, including the solicitation of sex acts, Mr. Grady said.

Mr. Grady argued that Mr. Myers might have enticed other minors with his tactic of posing as "a partially clothed female" with the caption "This is me." He would ask the boys to send pictures of themselves naked.

Mr. Grady said Mr. Myers chose professions that would give him maximum exposure to his potential prey. He said Mr. Myers also got in touch with other sex offenders for luring tips and was in a position to use his victim's photos as a means to silence and to blackmail them to engage in further sex acts.

Katherine E. Godin, the defendant's lawyer, said Mr. Myers was a "contributing member of society in many regards" until his arrest last year.

Apart from his four years living in Gettysburg, Pa., to obtain an undergraduate degree, Mr. Myers has lived in his childhood home his entire life, she said. He had a happy childhood and remains in "a close-knit family," she said.

Ms. Godin argued that her client had a "sincere passion" for volunteerism and devoted his life to it and said he did not do this to cultivate and groom victims, as the assistant district attorney insisted.

She also argued that there was no evidence that Mr. Myers ever distributed child pornography, no evidence that he would have used the images as blackmail or to silence his victims and no evidence he ever touched or would have touched a child if a meeting had ever been set up. She also said that the photos that were labeled pornography included shots of nature and country music videos.

Six letters of support were introduced at the sentencing hearing Monday — from Mr. Myers' parents, two sisters, a neighbor and a former neighbor. Mr. Myers also wrote a letter.

The bespectacled defendant, who at one time was a lawyer, kept his head down and his hands clasped in front of him throughout the hearing until it was his time to speak on his behalf.

"While I know I can't change the past, not a day goes by that I wish I could change what I have done," Mr. Myers said. "No worthy son, no decent brother, should put a family in such a position or ask them to endure such things.

"I love you guys so very much. I can never repay you for your love and kindness."

Mr. Myers, who had no criminal history, said that his victims knew him and trusted him, and that although he never touched them,he acknowledged that he has left emotional scars.

"The anger that you have for me is matched by the shame and guilt I feel," Mr. Myers continued. "I hope one day that you understand how truly sorry I am for what I did."

Mr. Grady said the government recommended the "just punishment" of 21 years of imprisonment, while Ms. Godin petitioned for 15 years.

Mr. Myers 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.

CDL A DELIVERY DRIVERS Home Every Night! Needed for our Worcester Depot! Drive local - No more spending valuable nights away from your family! As a Direct Store Delivery Representative YOU have the opportunity to make a difference with our customers! Provide excellent customer service; interact in a positive manner with our customers; deliver our products to local stores. Be home every night! Work for a Company that has been around for over 80 years! Minimum of 3 months driving experience with CDL A/B; GED or HS diploma required; Must be able to drive a standard transmission. EEO/Veteran/Disability Growing Strong Since1933!