MATTHEWS, N.C. -- A North Carolina high school student shot and killed a fellow student during a fight in a crowded school hallway Monday morning, officials said, prompting a lockdown and generating an atmosphere of chaos and fear as dozens of parents rushed to the school to make sure their children were safe.

Authorities said bullying led to the shooting and the conflict started several days before the fatal encounter.

The police department in Matthews, about 12 miles southeast of Charlotte, said 16-year-old freshman Jatwan Cuffie was taken into custody by a school resource officer about 10 minutes after the shooting at Butler High School. Police Capt. Stason Tyrrell said Cuffie admitted the shooting to a teacher and the teacher helped arrange his surrender to police.

Jatwan Cuffie WBTV

"It's been an extremely tragic event for us here in Matthews for the Butler High School community," Tyrrell said.

Get Breaking News Delivered to Your Inbox

Tyrrell said a school resource officer who was in the building heard a commotion in a hallway adjacent to the cafeteria at 7:14 a.m. and saw students running away. He arrived at the scene seconds later and started rendering aid to the wounded student. Three other officers were on scene within minutes, he said.

The victim, 16-year-old sophomore Bobby McKeithen, was transported to a hospital and died there.

Charlotte-Mecklenburg Schools Superintendent Clayton Wilcox called the incident "isolated."

"The conflict began with bullying and escalated out of control," Wilcox said. "As fear took over, the young person brought a gun to solve the problems."

Wilcox' comment appeared to imply that the shooter was the person who was bullied, but Tyrrell later wouldn't specify whether it was the suspect or the victim who was bullied.

"We heard a bang and we seen them starting to fight... All of the sudden he pulled out a pistol and everybody started running." HS senior describes fight that led to fatal shooting @ Butler HS to @LaurenTost. "I ran all the way down the hallway." MORE » https://t.co/AnTHERcXud pic.twitter.com/YMFvVYwMGa — Mark Davenport WBTV (@TheDavenReport) October 29, 2018

"We're incredibly sad, and we're sorry for this family," Wilcox said. "But we're also sorry for the young person who thought the only way to solve this problem was with a gun."

Wilcox said "dozens if not hundreds" of students witnessed the shooting before fleeing in panic. He said grief counselors would be made available.

"I think it's fair to say that more lives than just two have been changed forever," Wilcox said.

Police have not confirmed what kind of gun was used. Wilcox said, "I don't know how a young person gets a handgun in the state of North Carolina." He said the school system was reviewing its security procedures. The school does not have metal detectors, he said.

The Charlotte-Mecklenburg School District said on Facebook that the weapon had been secured by law enforcement. The school was placed on lockdown, which has since been lifted. Families were allowed to pick up students from the entrance to the campus.

Before the lockdown was lifted, dozens of parents gathered outside of the school to await word on the students. Multiple parents told local television channels that they felt confused and unsure about where to meet with their children. Video provided to CBS affiliate WNCN by a freshman student showed panic in a crowded hallways in the aftermath of the incident, with students asking to be let out of the school.

BREAKING: Student shot at Butler High School has died in hospital @WBTV_News pic.twitter.com/Zt1i6aX0D8 — Caroline Hicks WBTV (@CarolineHicksTV) October 29, 2018

"A kid was shot, they want us to go to class," the freshman, Joshua Cherry, is heard saying in the video. "Kids are crying. It's a mess."

When students were allowed to leave, the video showed students streaming out, with many crying and hugging parents. Classes were be held for students remaining on campus, the district said. About 100 of the 2200 students were released at normal dismissal time, Wilcox said.

Wilcox defended keeping students in the building, saying they wanted to ensure safe transport before allowing them to leave.

In a statement released to the station, North Carolina State Superintendent Mark Johnson said "I am heartbroken to hear that we have lost a student to school violence in one of our schools."

"We have contacted Charlotte-Mecklenburg authorities and will assist in any way we can, but of course our first thoughts are for the parents and other loved ones of the student who passed away," Johnson said. "The safety of our students is paramount. This is a sad day for all of North Carolina, and we must work together as a community to address these problems."