It started with a hoax active shooting call to local police. An all-boys Catholic prep school went on lockdown, and police swarmed the campus. Some students fled into the surrounding woods. Then, things got worse.

As officers in Danvers, Massachusetts, cleared classrooms and buildings on Monday at St. John’s Preparatory, a school of 1,450 boys in sixth through 12th grade, a shot went off, triggering a larger police response. But it was a police officer who accidentally discharged a weapon in a bathroom of a middle school building, officials said, not an active shooter.

Still, the reports of gunfire “elevated the situation from a normal swatting response to an actual active shooter situation,” said the town of Danvers, a suburb about 20 miles outside Boston with about 28,000 residents, on Facebook. Nobody was injured and no threat was found, officials said.

Danvers Police Chief James Lovell said the shot that was fired triggered a heightened law enforcement presence at the school during an already chaotic situation. He said police chiefs at neighboring departments came to offer assistance.

The fake call that an active shooter was on campus came in at about 1:45 p.m. Monday, Head of School Edward Hardiman said at a press conference. The school went on lockdown and students and staff followed procedures that were practiced during drills, he said. The school is believed to be the target of a “swatting” call, officials said.

“Our students, our faculty and staff did exactly what they were supposed to do,” Hardiman said. “This is everybody’s nightmare. Every parent, in the context of our culture today, is concerned that things like this can happen.”

SWATTING CALLS A ‘CRUEL HOAX’:Schools across US hit with dozens of false shooting, bomb threats

“Swatting” calls attempt to deliberately draw a large police or SWAT team response with a fake report of an active shooter on a school campus or another serious crime at another location. The calls can be targeted toward individual people or specific locations by pranksters or malicious bad actors, but are often used against seemingly random targets as part of a larger trend. Some swatting calls are computer generated or made using technology to spoof caller ID, making them potentially difficult or impossible to trace.

Schools across the country have been targets of hoax active shooting calls in recent months, which a review by USA TODAY last fall showed can amount to 30 in a single week. The calls have locked down schools, causing kids to hide under desks, panicked, and parents to flock to campuses.