Two Conestoga Valley High School students were charged for having a weapon on school property after they posted the proof on their social media sites.
East Lampeter Township police said the 15-year-old boy and 14-year-old girl posed for photos with an authentic-looking BB pistol.
Administrators were tipped off to the photos Wednesday and notified the school resource officer.
When the students were questioned, investigators learned they brought the BB gun to the school the previous day for the purpose of photographing themselves with the gun to post on Instagram and Twitter, police said.
The gun was an exact replica of a Beretta 92F handgun and had no orange markings, police said.
In addition to criminal charges, the two were removed from school pending further investigation and disciplinary action.
The girl was committed to Lancaster County Youth Intervention Center and the boy was in the custody of his parents.
Authorities said they do not believe at this point that the students had any intentions of harming anyone.
They said their investigation continues and additional charges may be filed.