(ABC News) – A New Mexico middle school teacher has been credited with saving many lives when he persuaded a 12-year-old boy into dropping his shotgun after he had wounded two students, according to officials.

New Mexico Gov. Susana Martinez said more students could’ve been injured if not for the heroics of teacher John Masterson, who confronted the alleged shooter Tuesday morning inside the gymnasium at Berrendo Middle School in Roswell, N.M.

“He starts to turn and see that the young man shoots and shoots, and then pointing the firearm at Mr. Masterson,” Martinez said at a Tuesday night news conference. “Mr. Masterson then begins to talk to him — to put it down. The young man put the gun down and raised his hands.”

A girl identified as Kendal Sanders, 13, underwent surgery Tuesday night and her condition has been upgraded to stable, Martinez said. She suffered injuries to her right shoulder.

An 11-year-old boy is in critical condition after suffering more serious injuries to his face and neck. The young victim underwent a second surgery during the day, according to Martinez. The family of the boy wished to not disclose his name.

The suspected shooter, a seventh-grader whom police have not named, was transferred to an Albuquerque psychiatric hospital after a hearing Tuesday, according to The Associated Press, citing attorney Robert Gorence, who is representing his family.

Gorence said the family will release a statement later today.

Authorities have preliminary though unconfirmed information that possibly some of the students were warned by the suspect prior to the shooting not to go to school, New Mexico State Police Chief Pete Kassetas said.

Gov. Martinez said the students were in the gym, where they typically hang out before classes start during cold and inclement weather. The 12-year-old allegedly opened fire with the shotgun there at about 8 a.m.

Kassetas said the weapon was hidden in a bag.

“We’ve confirmed that it is a .20-gauge shotgun that the stock, the wood stock was sawed off,” Kassetas said.

Odiee Carranza, an eighth-grade student, told The Associated Press that a boy bumped into her as he rushed toward the gym and apologized to her. When the boy entered the gym, Odiee said, she saw him pull a gun out of a band instrument case and begin shooting.

She said he shot another boy twice in the face and shot a girl in the arm.

“Then he shot up in the sky, then dropped the gun, and then some teacher grabbed the kid that had the gun,” Odiee told the AP.

Masterson, an eighth-grade social studies teacher, eventually encouraged the shooter to put down the gun and raise his hands. The governor said Masterson put the boy up against the wall as police began to arrive in the gym.

Martinez complimented the students for exiting the gym in an organized fashion and credited drills the school had conducted in the past.

The alleged shooter was taken into custody and the chief said it is believed he acted alone.

Kassetas did not disclose a possible motive, but said investigators are “looking at social media outlets and the different forms of communication these kids use to talk to each other.”

Warrants have been issued for the suspect’s home, locker and bag. Kassetas said the suspect was still in the process of being charged, but wouldn’t say what authorities were considering filing.