Los Angeles, California (CNN) -- A 17-year-old boy arrested after a handgun in his backpack accidentally discharged and wounded two other high school students Tuesday was able to bring his automatic pistol on campus apparently because the Los Angeles school does only random metal detector checks, police said.
The chief of Los Angeles Unified Schools District police, Steve Zipperman, said the district's policy calls for random screening with metal detectors, to be determined by each school's principal.
"It is a possibility that the student who walked on with that backpack was not checked," Zipperman told reporters.
The arrested student, a senior whom authorities didn't identify, entered a health class Tuesday morning and set his backpack on a desk, Los Angeles Police Deputy Chief Patrick Gannon said.
When the backpack landed on the desk, the automatic handgun discharged, firing a single round that struck a girl in the temple and a boy in the neck, Zipperman said.
The student then fled, prompting a police search, Gannon said. Police were told the boy went to another classroom, and he was taken into custody about two hours after the shooting, Zipperman said.
Zipperman said the shooting appeared accidental. "Based on the information we have, it appears that it's a possible accident," he said. "There was no struggle taking him into custody."
Los Angeles Mayor Antonio Villaraigosa said he was keeping the victims and their families in his prayers.
"No student should ever fear for his or her life within the halls and classrooms of our schools," the mayor said in a statement. "We must work together to ensure safety in and around our schools so that all students can benefit from an environment conducive to learning."
The 15-year-old girl had head surgery early Tuesday afternoon at Harbor-UCLA Medical Center in Torrance, California, and was in critical condition, Hospital Chief Medical Officer Gail Anderson told reporters Tuesday.
The bullet struck the left side of her head, Anderson said, gesturing to his temple as he spoke. The bullet then also exited from the same area and didn't pass through her head, though it caused some fracturing to the girl's skull, Anderson said late Tuesday afternoon.
The girl suffered "a significant blood clot on the left side of her brain." Doctors removed a piece of her skull and haven't replaced it yet because the brain swells 48 hours after such an injury, Anderson said.
When the girl arrived at the hospital by ambulance, she was unconscious, said hospital Dr. Scott Bricker. "She already had signs of a significant brain injury" from the shock wave of the bullet striking her skull, Bricker said.
Said Anderson: "We're going to be looking for her to be moving her arms and legs" when she awakens.
Physicians didn't find any evidence of bullet fragments, Anderson said.
The 15-year-old boy was in fair condition with a neck wound, and he didn't need surgery, Anderson said.
"He seems to be resting comfortably," Anderson said. "The boy, he's in a lot better shape right now. But we can't tell until we get more information."
Students and faculty were dismissed from the school at 1:52 p.m., authorities said. The high school had been under lockdown shortly after the 10:41 a.m. shooting.
Those students who witnessed the shooting were giving statements to authorities and will be given an opportunity to speak to counselors, if needed, Zipperman said.
Police corrected an earlier report that at least three people were shot at the school, Gannon said.
In 2002, two students were seriously wounded in another shooting on the campus when three other students demanded money from one of them, the Los Angeles Times reported. Both students recovered from the gunshot wounds, and the three student assailants were sentenced to jail, the newspaper reported.
CNN's Casey Wian, Sonya Hamasaki and Sara Weisfeldt contributed to this report.