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.
SFPD telling parents to go to the Balboa High School football field to reunite with students following lockdown. 3 students in custody, one student with non life threatening injuries, 1 gun recovered. #abc7now— Katie Utehs (@KatieUtehs) August 30, 2018
SFPD confirms 3 Balboa High School students in custody, 1 student has non-life threatening injuries. Gun recovered, but @SFPD will not confirm if it was fired or not. School given all clear. #abc7now pic.twitter.com/jRUdD5pZQQ— Katie Utehs (@KatieUtehs) August 30, 2018
Parents staging around Balboa High School in #SF. Students tell parents there’s a lockdown & they’re under their desks. Reports of shots fired within the school. Police canvassing neighborhoods. #abc7now @sfpd pic.twitter.com/OXK2nVf0ws— Katie Utehs (@KatieUtehs) August 30, 2018
Police sources tell ABC7 News they have found a gun inside Balboa High School. They are now trying to identify who owns the gun. Call came in as shot fired; no confirmation yet, no report of injuries. Stay with ABC7 for the latest. #ABC7now https://t.co/DAcXdh93zB— Dan Noyes (@dannoyes) August 30, 2018
An incident has occurred at Balboa HS. #SFPD is on scene. Balboa HS, James Denman MS & Leadership School are on lock down at this time. SFPD PIO @OfficerGrace is responding, Media staging area will be at the intersection of Onondaga & Cayuga Ave. #SF pic.twitter.com/rfH4wmz8FA— San Francisco Police (@SFPD) August 30, 2018