At least two people are dead after a 16-year-old boy pulled a handgun out of his backpack at a Southern California high school, shooting five of his fellow students.

The gunman then turned the gun on himself but did not die from the gunshot wound to the head. Los Angeles County Sheriff Alex Villanueva told reporters the suspect was in "grave condition" at a hospital.

The deceased victims were identified as a 16-year-old girl and a 14-year-old boy. The other wounded victims were identified as a 15-year-old girl, a 14-year-old girl, and another 14-year-old boy. The sheriff reports that the wounded survivors are not in critical condition.

The gunman and the victims all attended Saugus High School in Santa Clarita. The shooter has been identified as Nathaniel Berhow.

"It's a .45-caliber semiautomatic pistol, which had no more rounds in it, had no more bullets in it," Sheriff's Department Captain Kent Wegener said. 

"I can confirm that that was posted on his account, and I can also confirm that it has been changed since this incident, which means there is somebody else that has access to this account, be it a hacker, or be it a friendly who has access to his password," Wegener said.

A motive for the attack is still unknown. 

"We didn't know if the shooter had a clear view of us or not, we just sprinted and we just like prayed for our lives," one student told CBS News. "I actually thought I was going to die."

"My teacher quickly sprang to his feet, got up, locked the door," said senior Mason Peters. "Turned off all the lights, and then we got a bunch of desks and stuff -- and then reinforced the doors, and then we all just like stayed hidden."