A federal judge in Massachusetts has struck down four key portions of a 2016 municipal ordinance in Newton, a Boston suburb that effectively banned drones.

The lawsuit, which was filed in January 2017 by a local doctor, involves a question that has yet to be fully resolved in the age of increasingly pervasive and inexpensive drones: how much can localities restrict them?

The Newton law, which was passed in December 2016, bans drone flights over private property at or below 400 feet without the property owner’s permission. The law also requires that all drones be registered with the city and that drones not overfly schools, city property, or sporting events without specific permission.

In a Thursday court order, US District Judge William Young concluded that these particular parts of the law went too far. He allowed the other sections of the law to stand and noted to city officials that they could re-draft it to accommodate federal law.

The judge wrote:

Newton's choice to restrict any drone use below this altitude thus works to eliminate any drone use in the confines of the city, absent prior permission... This thwarts not only the FAA's objectives, but also those of Congress for the FAA to integrate drones into the national airspace. Although Congress and the FAA may have contemplated co-regulation of drones to a certain extent, see 81 Fed. Reg. 42063 § (III)(K)(6), this hardly permits an interpretation that essentially constitutes a wholesale ban on drone use in Newton.

Judge Young allowed other unchallenged sections of the ordinance that had to do with privacy, noise, and safety to remain in force.

As Ars reported earlier this year, other cities have already tried to restrict how and where drones can fly. More than a year ago, lawmakers in West Hollywood, California, voted to regulate drone flights after one crashed into a power line.

Last year, a report from the National Conference of State Legislatures noted that in Nevada, property owners now have the right to sue for trespass for any drone operator who flies at a height of less than 250 feet over their property if the owner has warned the pilot once before. Similarly, a law in Oregon also allows for civil suits, but the height requirement is less than 400 feet. Ars is not aware of any civil complaints that have been filed in those states as a result.

Amanda Essex of the NCSL told Ars that at least seven states—Arizona, Delaware, Maryland, Michigan, Oregon, Rhode Island, and Virginia—have passed laws that forbid municipalities in those states from regulating drones.

For his part, the Newton doctor, Michael Singer, told Ars that he was pleased with the ruling.

"The Newton ordinance would have outlawed life-saving technology that may soon be available to our community," he e-mailed, citing this June 2017 press release from Sweden.

Attorneys for Newton did not immediately respond to Ars' request for comment.