LOS ANGELES - Jordan Valenzuela was in class when he heard the bang, and then the screaming.
In a classroom next door, a 15-year-old boy had been shot in the head, a 15-year-old girl was shot in the wrist and several others were struck by broken glass.
Jordan tells The Associated Press that his 12-year-old classmate at Salvador B. Castro Middle School told him it was an accident.
The sobbing girl told him: "I didn't mean to. I had the gun in my backpack and I didn't know it was loaded and my backpack fell and the gun went off,'" the seventh-grader said.
The shooting was reported just before 9 a.m. at the school, which has about 365 students in grades 6-8.
The girl was taken into custody minutes after the shooting. TV video from helicopters showed a dark-haired girl in a sweatshirt being led from the school in handcuffs as anxious parents and family members gathered on a street corner, many crying and talking on their phones as they waited.
Police interviewed the girl and agreed it was an accident. On Thursday evening, long hours after chaos and panic had subsided, the girl was booked into Juvenile Hall on suspicion of negligently discharging a firearm on school grounds.
Police haven't said from where the girl got the semi-automatic handgun or why she brought it to the downtown campus.
Five people were injured in the shooting. The most seriously hurt was a 15-year-old boy who was shot in the head but doctors said the bullet didn't hit anything vital or life-threatening.
"This child was extremely lucky," said Dr. Aaron Strumwasser at Los Angeles County-USC Medical Center. "I think he will do fine ... I anticipate he'll make a full recovery."
A 15-year-old girl was shot in the wrist but Strumwasser said the injury was minor.
Three other people had minor face or head injuries, some from broken glass, but weren't shot, officials said.
An 11-year-old boy and a 12-year-old girl were treated at the hospital and released while a 30-year-old woman who is a school staff member had only minor injuries, Los Angeles city police said in a statement.
Shallin Lopez, a seventh-grader, was in the room at the time of the shooting. She said she never saw a gun.
"I just saw something pop," she said. "It was loud. I didn't see her shoot."
Jordan Valenzuela, the 12-year-old student who was next door, told The Associated Press by telephone that after her heard the gunshot and screaming, children in the other classroom started banging on the door connecting the two rooms.
He and some other children opened it and began trying to help the victims. Jordan said he noticed his friend sitting at her desk with her hands covering her face.
Jordan said later, the girl asked him to hide the backpack with the gun in it.
"I said 'No,'" he said. "Then I moved away from her because I was a little bit scared."
But, he said, "she doesn't do bad things, she just stays quiet."
The campus was locked down but later most classes continued, although parents were permitted to take their children home early if they wished.
The shooting left parents shaken.
Claudia Anzueto, Jordan Valenzuela's mother, said the boy was crying when he called her from a borrowed cellphone to tell her he was OK.
"Not safe, very insecure," Anzueto said of the school. "I fear for my son's life. You know what I mean, you really hear about things like this in the news, and just to hear that something like that happened so close to home, it scared the life out of me."
Most weapons "that our young people get their hands on" come from their homes or those of other family members, Los Angeles School Police Department Chief Steve Zipperman said.
It wasn't immediately clear how she managed to bring it into class, he said.
The district has a policy requiring every middle and high school campus to conduct daily random searches by metal-detector wands at different hours of the school day for students in the sixth grade and up.
Student Melanie Valencia, 13, said the school did a random security search Thursday, but that she's never been checked.
Some officials used the shooting to call for gun safety legislation and others said it should give gun owners pause.
"This is a very important call to action to every adult in our community who has a gun," City Attorney Mike Feuer said. "You must store it safely and keep it out of access for any child to reach. It could result in a tragedy."
Associated Press writers Christopher Weber, John Antczak, Michael Balsamo, Krysta Fauria and Brian Melley in Los Angeles contributed to this report.