In a story that manages to be both horrifying and grimly instructive, an Oregon teacher threw her mobile phone before tackling a teen gunman and trying to wrestle a shotgun away from him during an attack on a special educational needs class. The scene: Silver Rail Elementary in Bend, Thursday lunchtime, where three children and a teacher were ultimately killed.

As she tussled with the 16-year-old suspect on the classroom floor, a bystander armed with a pistol ran inside and shot the teen dead. The bystander, a father of two girls at the school, had been driving past when he saw the suspect firing in the car park and then shooting through a window to enter. Police said the suspect was a former student at the school.

Authorities noted the suspect was armed with about 44 more rounds of shotgun ammunition when he was stopped. He had already fired as many as 15 rounds inside the classroom. "To the people who showed courage in the face of such violence, and intervened to prevent this tragedy from being any worse, we owe you a debt of gratitude," Bend Police Chief Mike Krantz said on Friday.

Police identified two of the four victims: five-year-old Rhoam Summer and 25-year-old teacher Meghan Lambert. The families of the other two students killed - an eight-year-old and an 11-year-old - did not wish to have them publicly identified yet. Two others were injured: another teacher, 54, was still being treated at hospital, and a seven-year-old student was in serious but stable condition.

Krantz said the heroic actions of both the teacher and the father saved lives. The teacher who wrestled with the gunman was not hurt but "almost certainly helped prevent more bloodshed." The suspect was identified as 16-year-old Griffin J John II, who previously attended the school and was a special educational needs student there. A search warrant has been executed at his home and a search is ongoing.

Police believe the suspect travelled to the school on foot, but are still investigating his exact movements and how he acquired the gun. A motive is also not clear. Officials did not confirm the name of the father who intervened, but Kaylub Giamanco's family identified him to US media as the person who sprang into action. The 36-year-old carpenter had just finished lunch and was on his way home when he passed the school, his brother told NBC News. He saw the suspect open fire on a vehicle outside then shoot through a window and go inside.

Police said Giamanco had a legally concealed .40 calibre in his vehicle, and his brother said he grabbed the pistol "and decided to go in after" the suspect. Police say he fired at the suspect "multiple times," killing him. Giamanco's mother, Kenda Freeman, who lives in Sacramento, California, told a local CBS station her son called her moments after the shooting, traumatised. "He said a man went into my daughter's school," Freeman said, pausing as she started to tear up. "And, um, shot kids. And he said, and I looked at him point blank, and I shot and killed him, mom." She added: "I told him he saved a lot of lives, and he said, mom, I couldn't save them all."

US President Donald Trump praised the bystander on Friday, calling him a "great hero." Addressing reporters at the White House before departing for Georgia, Trump said the situation could have been "much worse" with no intervention. "It's a terrible thing, but thank goodness for a man that had a gun and knew how to use it," he said.

Oregon Governor Tina Kotek acknowledged the man's heroic actions stopping further loss of life, but noted they "carry a heavy emotional burden, and I just want you to know that my thoughts are with you as well."