The Salem, Va., firefighters were standing outside on a summer day in 2019 when a drone — its blades whirling in a high-pitched whine — headed right for them, sending them scurrying, authorities said.

Then it came again.

“They had to dive out of the way to avoid being struck,” said Christopher Kavanaugh, U.S. attorney for the Western District of Virginia. Some city police officers also were sent scrambling.

The harassment outside the firehouse in Salem — located feet from a monument of steel beams retrieved from the wreckage of the World Trade Center’s North Tower felled in the 9/11 terrorist attacks — continued until the first responders retreated into the station. The drone then followed them into the garage, investigators with the U.S. Transportation Department said.

As the popularity of drones has grown in recent years, so has their misuse. The proliferation of small aircraft involved in untoward actions has led federal investigators to try to rein in some of the most egregious behavior.

The Virginia case is among a handful of drone-related prosecutions that have led to recent convictions.

Ultimately, the drone smashed into a pole, and no one was injured. James Russell Weeks III, of Salem, pleaded guilty recently in connection with the July 2019 incident.

Under a broad provision in federal law, Weeks was charged with flying an unregistered aircraft, which covers drones that weigh more than 0.55 pounds. Prosecutors say that catchall charge and other similar provisions offer straightforward tools for dealing with a range of crimes using drones.

In June, a Georgia man who was jailed for armed robbery was sentenced to 12 months for allowing someone else to use, or try to use, his unregistered aircraft. Federal prosecutors said the man and his brother had plotted to smuggle cellphones and tobacco into Telfair State Prison, but his brother and an accomplice were stymied by sheriff’s deputies in nearby woods.

Last year, a Bangor, Pa., man was sentenced to five years in prison after pleading guilty to operating an unregistered aircraft as well as firearms charges. Federal prosecutors said the man, who had been subject to a domestic violence protective order, dropped small, homemade bombs from a drone to scare his ex-girlfriend and “terrorized an entire community.”

The Salem investigation was led by the Transportation Department’s inspector general’s office. Given the proliferation of drones, the office “is committed to doing all that we can to help ensure that unmanned aircraft systems are operated legally, especially where public safety and the operations of first responders is concerned,” it said in a statement.

The Federal Aviation Administration, which is responsible for the safety of U.S. airspace, said a regulation finalized earlier this year will require drone operators to broadcast identification information and their aircraft’s location using radio frequencies. That will aid law enforcement trying to connect unauthorized drones with people flying them, the agency said. Operators must comply by September 2023.

“Remote identification will help law enforcement determine if a drone poses an actual threat that needs to be mitigated, or if it’s an errant drone that got away from someone but means no harm,” the FAA said in a statement.

The case in Salem, a city of 25,000 just west of Roanoke in western Virginia, left many residents mystified. Was it more threat or nuisance? An ill-considered prank, or a lapse in judgment?

Randy V. Cargill, an assistant federal public defender representing Weeks, declined to say what might have been behind his client’s actions, citing a policy against commenting on pending cases. Asked if Weeks intended to harm anyone, he noted that “no assault charges or anything akin to such were filed.”

Kavanaugh, the U.S. attorney, said Weeks had “used his drone to harass public servants,” and that he flew it in protected airspace around a local airport, warranting federal charges. In court filings, Weeks admitted to facts in the case as part of a plea deal, including flying the drone at the fire station.

“On July 25, 2019, firefighters at Salem’s main fire station were ‘buzzed’ by a drone aircraft that darted at them a number of times,” according to a filing signed by Weeks, his lawyer and an assistant U.S. attorney.

Later that day, Weeks appeared at the Salem police station to ask for the return of his incapacitated drone, which had crashed into a pole.

As part of the plea agreement on the felony charge, prosecutors agreed not to pursue prison time. There was no agreement on probation or financial penalties. A sentencing date has not been set.

Police did not return Weeks’s drone.

Salem deputy police chief Derek Weeks (no relation to James Weeks) said it did not surprise him that someone would misuse a drone in that way, but he balked at the notion that James Weeks’s actions were a threat.

“I don’t think it came across that way,” the deputy chief said, though he noted he wasn’t there during the incident.

Added Salem fire chief John W. Prillaman: “They were surprised, but they never felt endangered.”

About a block from the spot where Weeks dived his drone at firefighters and police sits the headquarters of a prominent Salem drone firm, Autonomous Flight Technologies. Salem city spokesman Mike Stevens found irony in that coincidence. The company’s work with filmmakers, farmers, mining operators and others underscores what advocates say are the upsides of drones.

“To us, this was an isolated incident,” Stevens said. “There had not been any such buzzing occurrences before, and we have not experienced any since.”