It happened at the Philadelphia Learning Academy - South in the 4300 block of Westminster Avenue.
PHILADELPHIA (WPVI) -- An 18-year-old student was rushed to the hospital after accidentally shooting himself in the leg inside a West Philadelphia school.
It happened inside the gymnasium of the Philadelphia Learning Academy - South in the 4300 block of Westminster Avenue around noon.
Police say there were other students in the gym when the gun went off, but no one else was injured.
The student was taken to the hospital by police officers where he is in stable condition.
Police say it's unknown what led up to the gun going off in the gymnasium. After it happened students and faculty were brought outside.
Officials say students have to go through a metal detector to get into school in the morning, so it's unclear how the student got the gun into school.
Students were re-scanned before being let back inside.
"We have metal detectors in all of our high schools. And we do a very thorough job in the morning. In this case the way we've often gotten our guns in is through side doors, potentially going around our system," Chief of School Safety Kevin Bethel.
Investigators searched for the gun outside of the school, even searching on rooftops. The gun was eventually recovered off of school property.
Students were sent home with a letter explaining that a student accidentally shot himself during lunch.
Officials ask parents to watch their children closely and check their rooms for weapons.
"Young people, their development is nowhere near understanding what a gun can do. In this case a kid shoots himself. God forbid something else could've happened with that weapon. So regardless of whether I or my men and women stop the gun from getting in, the fact that a child has a gun is a problem," said Bethel.
District officials say the investigation is still ongoing to determine exactly how this weapon got into the school.
Once they know more they say they'll look at adjusting protocols to keep guns out.