By LINDSAY WHITEHURST

SALT LAKE CITY (AP) — A teenager caught with a loaded gun at his northern Utah high school planned to shoot a former girlfriend and open fire on the rest of the school, police said Tuesday.

Another student caught a glimpse of the handgun around noon Monday at Fremont High School and reported it before any shots were fired or anyone was hurt, Weber County sheriff’s Lt. Lane Findlay said.

The student appeared to be angry over rumors going around about him and suspected a girl he had dated started them, Findlay said. The 16-year-old boy was arrested on suspicion of three counts of weapons possession.

“It’s terrifying when you think about what could have happened,” Findlay said.

The student had a 9 mm semi-automatic gun capable of holding 11 rounds, though it wasn’t immediately clear whether it was fully loaded when he was arrested, he said.

About 1,700 students attend the school in Plain City, a town of about 6,000 that is 45 miles north of Salt Lake City. There are about 300 members of the faculty.

The school was evacuated and locked down for about four hours while about 70 officers searched classrooms. The student initially said there may have been someone else involved.

“We just can’t take any chances in a situation like this,” Findlay said. Police didn’t find any other weapons in the school and don’t believe anyone else was involved.

The teen was booked into a juvenile detention center on suspicion of possession of a firearm by a minor, possession of a firearm in a school, and possession of a weapon with intent to assault.

His name was withheld because he is a juvenile.