A student is in custody after a shooting at a middle school in Noblesville, Indiana.

One student and one teacher were taken to nearby hospitals, though their conditions remain unclear.

A teacher swatted the gun out of the shooter's hand when he entered a classroom, potentially saving students' lives, a seventh-grader told news outlets.

Authorities also acknowledged that a "secondary threat" was made at Noblesville High School.

One student and one teacher were injured in a shooting at Noblesville West Middle School in Indiana on Friday, authorities said.

A male student believed to be the shooter is in custody, the Noblesville police chief, Kevin Jowitt, said at a news conference.

The student had asked to be excused from his class, left the room, then returned armed with two handguns and opened fire, Jowitt said. Police received the first emergency call at 9:06 a.m. local time.

Jowitt didn't clarify what happened next but said that the situation was resolved "extremely quickly" and that the student was taken into custody.

The student victim was taken to Riley Hospital for Children, and the teacher was brought to Indiana University Health Methodist Hospital, a spokeswoman for Indiana University Health named Danielle Sirilla told The Associated Press. Their conditions are unclear.

An Indiana State Police helicopter lifting off from the middle school. The Indianapolis Star/Robert Scheer via Associated Press

The suspect is believed to have acted alone, Bryant Orem of the Hamilton County Sheriff's Office told the AP.

One seventh-grade student who witnessed the shooting told a local TV news station that a teacher swatted the gun away from the shooter when he entered the science classroom, most likely preventing other students from being shot.

It's unclear whether the teacher was the adult injured in the shooting.

The AP reported that a seventh-grader named Ethan Stonebraker said the class was taking a test when a shooter walked in late, pulled out a gun, and opened fire.

The teacher "immediately ran at him, swatted a gun out of his hand, and tackled him to the ground," Stonebraker said, adding that "if it weren't for him, more of us would have been injured for sure."

A "secondary threat" was also made at the Noblesville High School, but there was no information to suggest that the incident was "anything other than a communicated threat," Jowitt said.

"We are taking steps to make sure that the school stays secure," he added.

Noblesville is a city of about 56,000 people, 30 miles north of Indianapolis.

The incident comes amid tension nationwide over deadly shootings at US schools this year. One week ago, a gunman killed 10 people at a high school in Santa Fe, Texas, and in February, a shooter killed 17 people at a high school in Parkland, Florida.