An 18-year-old student shot himself in the leg inside a West Philadelphia school Friday afternoon, authorities said, in an incident that raised questions about school security amid a citywide gun violence crisis.

Officers responded to the Philadelphia Learning Academy-South school at about 1 p.m. Friday and found the student in the gymnasium suffering from a gunshot wound to his thigh. He was hospitalized in stable condition.

Dozens of students were in the gym when the incident took place, and the school immediately locked down. The school, on the 4300 block of Westminster Avenue, is a district alternative school that serves students in grades 7 through 12.

Friday afternoon marked the third time in two weeks that a Philadelphia student was shot in or near a school, and it comes as the city is on track to log more shootings this year than in any other year in at least three decades. On Wednesday, Philadelphia Police announced the force will roll out a new strategy next week to increase its presence in two dozen school zones citywide.

But authorities Friday were still investigating how a firearm wound up inside PLA-South when Philadelphia School District policy requires students to be scanned by metal detectors upon entrance.

Christina Clark, a school district spokesperson, said the student didn’t bring the gun in through a door with a metal detector. She said school officials and police are reviewing surveillance footage to trace the student’s movements through the school before the shooting.

Robin Cooper, president of the district’s principals’ union, said school leaders across the city are worried that students can circumvent security systems and bring guns into school buildings.

It’s particularly worrisome, Cooper said, given staffing levels.

“You have to remember, when you have places that are not adequately staffed, shortages everywhere, it’s a problem,” she said. “We keep sounding the alarm.”

» READ MORE: ‘Why do we just live to die?’: Community comes together to say enough to shootings near Philly schools

The school, which houses three separate disciplinary programs, is supposed to have four school security officers. It only has two assigned, Cooper said, and one was absent Friday.

Advocates, parents, and school leaders had expressed concerns about safety leading into the school year as the city is confronting high levels of gun violence. Nearly 1,900 people have been shot this year in the city, and about 10% of them were under age 18. Thirty-five of those victims have been shot since the start of the school year, police statistics show.

The incident was the second school-related shooting this week.

On Monday, a 16-year-old student at Abraham Lincoln High School in Mayfair was critically wounded when a gunman opened fire during an argument outside the school. A stray bullet flew into a passing car, killing the driver, 66-year-old Jeffrey Carter.

Authorities filed murder and attempted murder charges against 21-year-old Aaron K. Scott, who investigators believe has a younger brother who had been a Lincoln student and was involved in an ongoing dispute. He was apprehended immediately after the shooting by two plainclothes officers who were stationed outside the school to monitor dismissal.

And on Oct. 8, 13-year-old Marcus Stokes was fatally shot in North Philadelphia at about 9 a.m. He was just blocks from E.W. Rhodes Elementary School, where he was in seventh grade.

Earlier this week, Deputy Police Commissioner Joel Dales said top brass met with district leaders to reassess security plans and deploy more resources to the residential areas and commercial corridors that surround schools.

He said authorities identified 25 zones that encompass 35 schools with the highest likelihood of experiencing gun violence. Schools not in those zones, he said, will still be routinely checked by patrol officers.