A gutsy science teacher single-handedly took down a student shooter at an Indiana middle school, stopping the gunman before anyone was killed Friday morning, authorities said.

Jason Seaman, an instructor at Noblesville West Middle School, didn’t hesitate when the male student interrupted a test by walking into a classroom armed with two handguns — and opened fire.

“Our science teacher immediately ran at him, swatted a gun out of his hand and tackled him to the ground,” said seventh-grader Ethan Stonebraker. “If it weren’t for him, more of us would have been injured for sure.”

The student fired off several rounds before Seaman, a former defensive end for Southern Illinois University, took three bullets while tackling him, according to witnesses and his mother.

The teacher and one pupil were wounded before the shooter was taken into custody near Seaman’s classroom. The educator reportedly restrained the suspect while shouting at his kids to run from the classroom.

Seaman was treated at the Indiana University Methodist Hospital for gunshot wounds to his abdomen, hip and forearm, his mother said via Facebook.

“Jason is out of surgery and doing well,” wrote Kristi Hubly Seaman. “PLEASE pray for the student that was also shot.”

A 13-year-old girl, who was hit, is being treated at a local hospital.

The gun-toting student asked to be excused around 9 a.m. — and returned with the weapons.

Noblesville Police Chief Kevin Jowitt said the gunfire ended “fairly quickly.”

Officials believe that the unidentified youth was acting alone, and provided no information regarding a motive for the attack.

Eighth-grader Chris Navarro said he heard the first gunshots shortly before the bell was due to ring for the change of classes.

“The speaker came on and said we were on lockdown, and people rushed in and we went to the back of the room,” said Navarro.

Jeremie Lovall said his daughter, a seventh-grader at the school, was in the classroom when the gunfire erupted. She phoned to tell her father she was all right and recalled the horrifying incident.

“She kept saying, ‘I saw my science teacher get shot,” he told the Indianapolis Star.

Seaman released a statement Friday evening.

“I want to let everyone know that I was injured but am doing great. To all the students, you are all wonderful and I thank you for your support. You are the reason I teach,” Seaman said.

His LinkedIn page listed him as the school’s seventh grade football coach.

He started teaching at the school about 20 miles northeast of Indianapolis four years ago.

“He’s a hero,” another student told local television station Fox59. “It was just something that most people would not have done but he was really brave to do it.”