(RIGBY, Idaho) -- A female middle school student opened fire on classmates in Rigby, Idaho, on Thursday, officials said.
Two students and one adult were injured, police said. The adult was treated and released from Eastern Idaho Regional Medical Center, while the two students -- one girl and one boy -- had non-life-threatening injuries, officials said.
Both will remain in the hospital overnight, and may require surgery, hospital officials said at a press conference.
The sixth grader removed a handgun from her backpack and began firing just after 9 a.m., the Jefferson County Sheriff's Office said at the press conference. Two people were shot in a school hallway, before she moved outside and another person was shot, the sheriff's office said.
A teacher disarmed the girl and held her until police arrived.
Once its investigation is complete, Jefferson County Prosecuting Attorney Mark Taylor told reporters his office will be filing "appropriate" charges, possibly including three counts of attempted murder.
A motive for the shooting is still under investigation, authorities said. The sheriff said he did not know where the student obtained the handgun.
"This is the worst nightmare a school district could ever face," Superintendent Chad Martin said at the press conference. "We prepare for it, but we're never truly ready for it."
The school district won't be holding classes on Friday, Martin said, but there will be counselors offering support at the local high school.
A sixth grader at the school, Lucy Long, told Idaho Falls ABC affiliate KIFI she heard pounding on her classroom's door and then two gunshots, followed by screams, running in the hallway and a third gunshot that sounded farther away.
"I was really scared," Lucy told the station. "I almost started crying, but I was trying to help my other friends that were crying feel better."
"We were so worried that someone was going to come in after they were pounding on our door, like they were going to try to get in and hurt us," she said.
Students were moved to a nearby high school following the incident, which was caught on the middle school's security system, the sheriff said.
The name of the student has not been released. The sheriff said she lives in nearby Idaho Falls and attended the middle school in Rigby.
Idaho Gov. Brad Little said he was staying updated on the shooting.
"I am praying for the lives and safety of those involved in today's tragic events," Little said on Twitter. "Thank you to our law enforcement agencies and school leaders for their efforts in responding to the incident."
ABC News' Matthew Fuhrman and Jenna Harrison contributed to this report.