SAN FRANCISCO (KGO) -- A 14-year-old freshman accused of bringing a gun to Balboa High School ran away after the gun accidentally discharged in a classroom, according to a source.
The student brought the gun to school in his backpack. No students were injured by gunfire, though one girl hurt her back, according to officials.
The student who brought the gun to school turned himself in at the Bayview Police Station Thursday afternoon. His mother took him to the station, which is near his home.
VIDEO: Student led off campus after report of gun at SF's Balboa High
Three students are being investigated as possible accessories after the fact. They were detained at Balboa High. ABC7 News has learned there is surveillance video showing the suspect handing those students something as he ran from campus.
A source tells us those students gave the gun to police after officers used the surveillance video to track them down.
A student sent ABC7 News video of a locked down classroom where you can see students on their phones looking for updates. Panicked parents did the same thing trying to reach students.
Video shows students on lockdown inside Balboa High School in SF
"Now I'm among the ranks of parents who've stood outside of police tape outside my child's school not knowing what is happening or what's happened to these kids or whether they're safe," said parent Moriah Ulinskas.
Freshman Nicholas Yousefi says the gunfire happened in his study hall in the small auditorium. Around 20 students were in the vicinity.
"We hear a loud bang. We look over, there's a hole in a chair, something on the ground. The teacher gets up, calls security," said Yousefi. "Everyone comes in and then we go to the next class and then they call the lockdown."
RELATED: Get help with improving our schools
San Francisco police scoured the high school land nearby elementary and middle schools. All went into lockdown.
"There are three subjects who are in custody related to this incident and there was also a firearm recovered from the scene," said San Francisco officer Grace Gatpandan.
"We have one individual who sustained non-life-threatening injuries and we're still working to determine the reasons for those injuries," Gatpandan added.