A gun in a student's backpack went off when he dropped it, wounding two students at his Los Angeles high school.
The 17-year-old, who is in custody, could now be charged with assault with a deadly weapon and other charges, said LAPD Captain Bill Hayes.
Capt Hayes said it was "plausible" that it was an accident but the boy was negligent to bring a loaded handgun to Gardena High School, a sprawling 1950s-era school.
John Deasy, incoming superintendent of the Los Angeles Unified School District, said there was no indication the student with the backpack had touched the gun before it discharged. "He literally dropped his knapsack on the desk, and it went off," he added.
Deputy police chief Patrick Gannon said the student, who was on probation for a fight at school last year, apologised before running to another classroom. "He said: 'I'm sorry', when the gun went off. It made it appear to the teacher that it was an accident," he said.
Detectives are trying to figure out where the boy got the 9mm semi-automatic pistol, which was recovered, and how he got into school.
Two 15-year-olds were struck with the same bullet. A girl suffered a skull fracture and bruising to the brain and developed a significant blood clot when the bullet grazed her skull, said James Ausman, a neurosurgeon at Los Angeles County Harbour-UCLA Medical Centre.
The blood clot was removed but the girl remained in critical condition. A boy was in fair condition after being hit in the neck.
The shooting occurred in a classroom at the school, where principal Rudy Mendoza said students were on a break. The 2,400-student campus about 15 miles south of down-town LA was locked down after the incident.
It was unclear how the teenager got in with the gun in his backpack, school district spokeswoman Gayle Pollard-Terry said.
Arriving students are checked with security wands on a random basis. No district school is equipped with walk-through metal detectors.