The heartrending moment an Oregon high school coach used a hug to stop a student carrying a shotgun into a classroom was captured on surveillance camera.

Keanon Lowe, a former University of Oregon football star who works as a football and track coach at Parkrose High School, was hailed as a hero when he disarmed Angel Granados-Diaz in a classroom on May 17.

Video obtained ABC Portland affiliate KATU shows a portion of the encounter, with Lowe backing out of a classroom holding a shotgun in his right hand, while with his left he is holding onto Granados-Diaz. Another teacher comes up and takes the weapon away.

Then, in an extraordinary scene, Lowe embraces Granados-Diaz with a bear hug.

At one point, it appears Granados-Diaz tries to break free, but Lowe continues to hold on to him as they talk and hug again.

Police eventually arrived and took Granados-Diaz into custody.

“I saw the look on his face, the look in his eyes, I looked at the gun, I realized it was a real gun and then my instincts just took over,” Lowe, 27, said after the incident.

“This was a best-case scenario,” Portland Police Sergeant Brad Yakots said at the time. “The staff members from all accounts did an excellent job.”

Initial reports said Lowe tackled the student, but the video, which was released by Multnomah County District Attorney’s Office Friday, shows the emotional moment the two shared.

Granados-Diaz, now 19, was suffering from a mental health crisis at the time, according to the station. He pleaded guilty to one count of unlawful possession of a firearm in a public building and one count of unlawful possession of a loaded firearm in public and was sentenced to three years of probation, KATU reported.

Lowe told the station when the student entered the classroom with the weapon, he was close enough that he lunged for the gun and grabbed it with both hands.

“Then it was just me and that student. It was a real emotional time. It was emotional for him, it was emotional for me,” he said back in May, according to KATU. “In that time, I felt compassion for him. A lot of times, especially when you’re young, you don’t realize what you’re doing until it’s over.”