Hoax shooting at Massachusetts school caused chaos. Then a cop mistakenly fired a gun.

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.

Students walk up a hill toward St. John's Prep in Danvers, Massachusetts, after a hoax call of an active shooter on Monday, May 22, 2023.

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.

Experts say the calls drain school and law enforcement resources and can traumatize communities.

Hardiman said he told students afterward: "Some of us are going to be OK. Some of us are going to be really traumatized by what happened, and it's our responsibility to reach out to each other, to care for each other."

Lovell said the origins of the hoax call were being investigated. The Danvers Police Department did not immediately respond to requests for comments about the investigations into both the false report and the accidental gunshot on Tuesday.

Students at St. John's Prep were reunited with families after the lockdown and students who fled campus on their own were accounted for, Hardiman said. The school was closed Tuesday.

This article originally appeared on USA TODAY: Hoax active shooting report at St. John's made worse when Massachusetts officer fires gun