(CNN) -- A ninth-grade student was in custody Saturday and charged with murder after he allegedly shot a classmate in the back of the head at their northern Alabama middle school, authorities said.
The shooting happened during a class change around 1:45 p.m. Friday at Discovery Middle School in Madison, just west of Huntsville, police said.
"I was walking down the hallway and just saw a whole bunch of kids start screaming and running, telling me there was a gunshot, (that) there was a kid that got shot in the ninth grade," seventh-grader Paxton Schremsher told CNN affiliate WAAY-TV.
Ninth-grade student Todd Brown, 14, died after being taken to a hospital in Huntsville, Madison Police Chief Larry Muncey said. No one else was hurt, CNN affiliate WAFF-TV reported.
Police said it was an isolated incident between Brown and the alleged shooter, though they said the motive was still unclear. One student, however, said he may know the reason.
"It was some discussion about gang-related things and the shooter just got fed up with it," student Jeremy Tuttle told WAAY.
The shooting happened in the hallway just outside the band room, WAAY reported, and immediately sent students running for cover.
"I was in the ninth-grade hallway and I just heard a loud pop, and it sounded like a gun. People started running," student Tyler Renn told WAFF.
"People started running toward the classrooms, so I just ran in a classroom and everybody was under the desks and the lights were off," ninth-grader Joshua Murphy told the station.
The school resource officer held the shooter and the school nurse stayed with the victim until the authorities arrived, said Madison City Superintendent Dee Fowler.
The school went into lockdown until 3 p.m., leaving panicked parents outside, unable to pick up their children.
One of them was Dixie Duncan, who sat in her car waiting to be allowed in. She read aloud a text message she said she received from her 14-year-old daughter inside the school.
"Mama, don't come to school. Watch the news. There's a possible shooting," the message read.
City officials planned a meeting at a high school Sunday with church leaders, city and school officials, and counselors. The meeting is open to the public.
"We'll continue as a community to work together to work through this," Madison Mayor Paul Finley said.
Muncey said the threat to the school is now over.
"It's a horrific event and I hate it, and I wish we could have changed it, but our schools are safe," he told reporters.