LOS ANGELES (Reuters) - Five people were wounded, including a student shot in the head, when a gun went off in a Los Angeles middle school classroom on Thursday, and a 12-year-old girl was taken into custody, police said.

The girl, whose name was not released, was booked at a juvenile detention facility on a charge of negligent discharge of a firearm, said Officer Tony Im of the Los Angeles Police Department.

Im declined to say if investigators believed the girl deliberately opened fire at Sal Castro Middle School near the city’s downtown district. Mayor Eric Garcetti told local KABC-TV at the scene that it was unclear if the shooting was accidental.

“We’re unclear whether a gun went off or if it was an intentional shooting,” Garcetti said. “Luckily there are no fatalities or serious injuries.”

Two students were hit directly by gunfire and three other victims were hit by shrapnel, police said.

A 15-year-old boy was hit by gunfire in the left temple and was rushed to hospital, where he was alert and talking when he arrived, said Dr. Carl Chudnofsky, head of emergency medicine at Los Angeles County-USC Medical Center.

He had no damage to “vital structures,” doctors said at a news conference, adding they were cautiously optimistic he would survive.

A 15-year-old girl was hit in the wrist and was in stable condition, Los Angeles Police Department spokeswoman Wendy Reyes said.

The three people with slight injuries from shrapnel ranged in age from 11 to 30 years old, Los Angeles Fire Department spokesman Erik Scott said.

Authorities said they were trying to determine how the gun was brought on campus. The incident triggered a lockdown of the campus and a neighboring high school. Parents swarmed the area seeking to be re-united with their children.

“As a parent, this is everyone’s worst-case nightmare,” Los Angeles Police Department deputy chief Robert Arcos said at a news conference.

The shooting, which took place in an elective class with children of different ages, was the latest outbreak of gun violence at a U.S. school.

Between 2000 and 2013, nearly 17 percent of so-called 160 active shooter incidents in the United States were in elementary, middle or high schools, according to a Federal Bureau of Investigation report. An active shooters is defined as a person trying shoot to death people in a confined area.

Department spokesman Tony Im said in a telephone call.