Updated

A female student opened fire at an Idaho middle school Thursday morning, wounding a custodian and two other students before being disarmed by a teacher and taken into custody, authorities said.

The shooting happened at Rigby Middle School in Jefferson County just after 9 a.m. The student, a sixth-grader, pulled the gun out of a backpack before she opened fire, authorities said. 

"During the shooting, a teacher disarmed the student and detained her until law enforcement took her into custody," Jefferson County Sheriff Steve Anderson said during a news conference. "She did take the handgun from the student."

Police walk outside Rigby Middle School following a shooting there earlier Thursday, May 6, 2021, in Rigby, Idaho. Authorities said that two students and a custodian were injured, and one student has been taken into custody. (AP Photo/Natalie Behring)

FLORIDA MAN ALLEGEDLY SHOOTS AND KILLS OTHER MAN DURING DISPUTE IN STARBUCKS DRIVE-THRU

The student was not in the teacher's class, Anderson said. The shooting started inside a hallway in the school where two people were shot and moved outside the building where the third victim was struck, he added. No motive was disclosed. 

Multiple law enforcement agencies responded to the scene. 

Two students and an adult who were shot were rushed to a hospital with injuries that were not life-threatening, said Dr. Michael Lemon, the trauma director for the Eastern Idaho Regional Medical Center. 

The adult was shot once and was released from a hospital. One student was hit once and may require surgery in the future. The other student was shot twice, Lemon said. He did not disclose where on the body the victims were struck. 

"This is the worst nightmare a school system can face," said district superintendent Chad Martin.

Students embrace after a school shooting at Rigby Middle School in Rigby, Idaho on Thursday, May 6, 2021. (John Roark /The Idaho Post-Register via AP)

All local schools will be closed Friday in response to the shooting, he said. 

Idaho Gov. Brad Little tweeted that he is "praying for the lives and safety" of those affected by the shooting.

Jefferson County's Prosecuting Attorney Mark Taylor said no decision on potential charges will be made until the completion of an investigation. 

"Once the investigation is completed, we will be filing appropriate charges, possibly including three counts of attempted murder," he said. 

CLICK HERE TO GET THE FOX NEWS APP

Students were being evacuated to Rigby High School where parents can pick up the children. The nearby Ririe School District said that while there was no direct threat to its schools at the time, it issued a shelter-in-place order as a precautionary measure.

Rigby is a small city about 95 miles southwest of Yellowstone National Park. 

The attack appears to be Idaho's second school shooting, The Associated Press reported. In 1999, a student at a high school in Notus fired a shotgun several times. No one was struck by the bullets, but one student was injured by ricocheting debris from the first shell.