SANTA CLARITA, Calif. - When gunfire rang out Thursday morning at his high school, basketball player Noah Sanchez was working on his outside shot in the gym before class, listening to pop music playing in his headphones.

He didn't hear the shots in the nearby quad, but word travelled fast, triggering a cascade of events that have become all too common during a school shooting.

Someone told the coach, who told someone to lock the doors and soon the boys' junior varsity basketball team was huddled in fear in a dark corner of the smelly locker room at Saugus High School, hoping for word that everything was OK but worried a gunman might burst through the doors.

Outside, it was not OK. A 16-year-old student had pulled a handgun from his backpack and shot five students before shooting himself in the head, authorities said. Two students died, and the suspect was gravely wounded.

Sanchez and his teammates didn't know what happened, but they soon got text messages with a mix of fact and fiction.

“It was scary because it was like we didn't know what was going on at that point,†the 15-year-old said. “One teammate got a text from his sister that said there was an active shooter on campus and we need to get somewhere safe.â€

They texted their families to say they were safe. They texted friends to find out if they were all right. They texted others to stay away if they hadn't arrived at school yet.

Sanchez warned a girl he was friends with not to come to school. She got the message just as she was about to get out of her car and walk into the area where the shooting happened. She thanked him, but said she was crying because she was worried about him.

Sanchez's older brother, Andres, also had received word of the shooting as he was headed for school. His father, Marcio Sanchez, an Associated Press photographer, had worked late Wednesday night at the Los Angeles Lakers-Golden State Warriors basketball game and was running behind schedule when his oldest son's phone started blowing up.

“He said, `Hold on, I'm getting texts,â€' Marcio Sanchez said. “`There's a shooter on campus, I don't think we should go.â€'

Had they been on time that morning, his son would have probably been walking into the campus quad around the time of the shooting, he said.

On campus, the sound of gunshots produced a wave of panic. Students ran from the school. Others bolted into nearby classrooms. Doors were locked. Teenagers huddled into safer places. Lights were turned off. They tried to stay quiet but texted madly.

A terrified Isabella Perez cryptically told her mother that she thought there was “someone on campus.â€

Her mother, Elisabeth Perez, told her to go to a classroom. Isabella was already in a class and told her mother she loved her.

“I love you, too,†her mother wrote, along with three hearts.

“I'm so scared I can hear the police,†Isabella texted. “I love you. I just gonna keep saying it.â€

Police with guns drawn swarmed the campus in this Los Angeles suburb of Santa Clarita. Sirens wailed and helicopters hovered overhead.

In the locker room, misinformation began to reach the basketball squad.

Other team members were hearing in group chats that several people had died, that students had been trampled in the chaos and the suspect had run away.

“We were just getting more and more news on the story, some false,†Noah said. “I believed it because it was happening in the moment.â€

Another player who hadn't been in the gym texted to say he had seen the shooting from the cafeteria and ran to safety.

Noah Sanchez's father, meanwhile, had taken his oldest son home and returned with his cameras to capture the scene outside the school while waiting for his youngest son.

He knew there was a massive police response and was confident his son was in a safe place with teammates and coaches.

Noah Sanchez said the locker room smelled foul, but time passed quickly as he and teammates sat together, illuminated by the glow of their phones.

“We were really, like, nervous,†he said.

Eventually sheriff's deputies arrived and escorted the boys back into the gym before releasing them to meet their parents.

Marcio Sanchez was calmly taking photos of parents overcome with emotion at seeing their children emerge safely from the scene of violence.

He put his camera down and dissolved into tears as his son approached.

“I lost it when I saw him,†Sanchez said.