Updated

A 15-year-old student opened fire Wednesday at an American school in Monterrey, northern Mexico, gravely injuring three students and a teacher before turning the gun to himself.

The shooter died at a hospital and three of the victims are "fighting between life and death," according to the latest update by Nuevo Leon Gov. Jaime Rodriguez. They were all shot in the head.

One boy wounded in an arm is out of danger, he said.

The entire scene was captured by a surveillance camera. The chilling video shows the shooter, identified just as Federico, opening fire from his desk first. He hits one classmate, who is seen collapsing to the floor, and then walks around the room shooting randomly. After a few seconds he pauses and takes the gun, a 22 caliber pistol, to his head.

Aldo Fasci, Nuevo Leon state security spokesman, said the motive was still under investigation.

Fasci said the boy brought the gun from home. It was unclear how he got the firearm into the school. Mexico had once had a program to checked book bags at school entrances, but in many places it has fallen into disuse.

“There was a reason why book bags were checked. I think we are going to have to start doing it again,” Fasci said.

Mexico has largely been spared the phenomenon of school shootings that has hit the United States. In one of the few previous incidents, a 13-year-old student shot a 12-year-old classmate in the head at a Mexico City middle school in 2004, seriously wounding her.

At the height of Mexico's drug war between 2008 and 2011, schools in northern Mexico had considered a much greater threat the possibility that stray bullets from drug gang gun battles outside schools might enter classrooms. Some schools conducted "duck and cover" drills to combat that possibility.

The Associated Press and Reuters contributed to this report.