Police said the girl, who is 16 or 17, brought the gun to school Thursday morning, showed it to another student and threatened suicide.
School officials locked down the classrooms from 11:52 a.m. to about 2 p.m. as police investigated the incident and searched the school with a SWAT team.
In the early afternoon, officers located the gun at the home of a friend of the girl.
After leaving the gun at the friend's home, the girl went to her own home, in Eagle Mountain.
Her father took her to the police station in the afternoon.
She had apparently left the school grounds with the gun before the lockdown.
Police said the girl made no threats to others and no one was injured.
Students said the girl may have been distraught by a recent breakup with her boyfriend.
As they were stuck in their classrooms for more than two hours, many students communicated via mobile phone text messaging.
Rumors, ranging from a drug bust to a found hit list, were rampant, they said.
- Todd Hollingshead