Keanon Lowe, a football and track coach and a security guard at Parkrose High School in Portland, Oregon, told reporters as he was leaving a police interview late on Friday he was tired but relieved at the outcome, The Oregonian/OregonLive reported.
There are no other suspects. Police declined to release the student's name and said they were still trying to determine if he fired any shots. Police spokesperson Sergeant Brad Yakots declined to confirm Mr Lowe's reported involvement.
"I'm just happy everyone was OK," Mr Lowe said as he walked out of the school about four hours after the incident, according to The Oregonian/OregonLive. "I'm happy I was able to be there for the kids and for the community."
Parkrose school district superintendent Michael Lopes Serrao said in a letter to families on Friday evening that before the incident two students had informed a staff member of "concerning behaviour" by that student.
Security staff then responded, found the student and quickly disarmed him, he said.
"Thanks to their heroic efforts all students and staff are safe," Mr Lopes Serrao wrote.
Mr Yakots, the police spokesperson, said the first responding officers found the gunman being detained by the staff member in the hallway. A firearm was recovered at the school, he added.
Parkrose was evacuated and a nearby middle school was on lockdown for several hours as the investigation unfolded. The high school students were bused to a nearby parking lot where they were reunited with their parents.
The outcome was "the best-case scenario, absolutely," Mr Yakots said. "The staff member did an excellent job by all accounts, (and) our officers arrived within minutes and went right in."
Students recounted how the student entered their government class in the school's fine arts building — separate from the main building — just before noon. Mr Lowe had been in the classroom earlier looking for the student, whom other students identified as an 18-year-old senior at Parkrose.
About 10 minutes before the end of class, the student appeared in the doorway in a black trench coat and pulled out a long gun from beneath his coat, senior Justyn Wilcox, who was also in the room, told The Oregonian/OregonLive.
The student did not point the gun at anyone, student Alexa Pope said.
Students fled out the back door because the gunman was blocking the main doorway.
"As I was running, I was just like, Lord don't let this be it," Ms Pope told the newspaper.
In college, Mr Lowe was a star wide receiver at the University of Oregon, playing from 2011 to 2014. He caught 10 touchdown passes in his college career and had nearly 900 receiving yards. He also saw playing time on special teams.
Mr Lowe began working at Parkrose last year as the school's head football and track and field coach, according to his LinkedIn profile. Before that, he worked for his high school alma mater, Jesuit High, where he earned state defensive player of the year as a defensive back and was a standout sprinter.
Students, parents and co-workers lauded Mr Lowe's actions on Twitter, calling him a hero. Several also noted that the school's prom, scheduled for Saturday, was still on.
Olivia Katbi Smith wrote on Twitter that she coaches track with Mr Lowe at Parkrose and was not surprised to learn what he did.
"As soon as I heard what happened I knew it was him because he would do anything for these kids. It was surreal to be waiting for my athletes behind caution tape today, but might have been much worse if not for Keanon," she wrote.
Lopes Serrao said the student with the gun will not be returning to school and that school will resume on Monday as usual with an enhanced security presence.