In a case that prosecutors said should serve as a lesson to other teens, a former North Penn High School student was sentenced Tuesday after admitting that he posted nude photos of classmates to a file-sharing website.

Brandon Tyler Berlin, 19, of North Wales, will be on probation for two years, and was fined $250 and ordered to perform 100 hours of community service, under a plea deal.

Berlin was arrested last year after, police said, he collected sexually explicit photos of more than 30 female classmates and posted them to a Dropbox file shared widely among students at North Penn.

"Many of the guys would ask their girlfriends at the time for [photos], and I would ask my girlfriend at the time for them," Berlin told Judge Gary S. Silow at a hearing in Montgomery County Court. "I'm very sorry for what I did."

He pleaded guilty to a charge of transmission of sexually explicit images by a minor, a misdemeanor under Pennsylvania's teen-sexting law. He could have faced a maximum penalty of up to two years in jail and a $5,000 fine.

Prosecutors said Berlin was under 18 when he posted most of the photos in 2014 and 2015. He was 18 when charged, and under an agreement between prosecutors and defense attorneys, the case was transferred to adult court after Berlin was charged with the misdemeanor.

Dozens of students were involved in sending photos, prosecutors said after a months-long investigation that drew attention to the Lansdale high school and the issue of teen sexting. Only Berlin was charged. Investigators found he had created the Dropbox account and was "most culpable," said Assistant District Attorney M. Stewart Ryan.

Matthew Quigg, his attorney, said Berlin had not thought through the consequences of his actions.

"His decision was based on the immediacy of wanting to have the pictures available to himself," Quigg said after Tuesday's hearing. "He never intended to spread them throughout the entire school."

Silow said he hoped Berlin learned a lesson and warned him that his behavior was "inexcusable, but probably happens a lot in our society." Silow said he hoped Berlin's case would serve as a warning to other teens that sending and sharing nude photos is degrading, could lead to arrest, and is potentially dangerous.

"I don't know how anyone can get this across to kids your age," Silow said.

Berlin, who graduated from North Penn last year and started college in the fall, was ordered to undergo a psychosexual evaluation.

Attorneys on both sides said they would be open to discussing community service options that would allow Berlin to share his story and warn other Montgomery County students about the hazards of sexting.

"The message is, first and foremost, to be extremely cautious about what you're sending people, to never send these sorts of images," Ryan said after the hearing. "And ultimately, if you're in receipt of any of these images, to get rid of them immediately and certainly not to gather them."

610-313-8116 @Lmccrystal