After San Francisco in May placed new controls, including a ban on facial recognition, on municipal surveillance, city employees began taking stock of what technology agencies already owned. They quickly learned that the city owned a lot of facial recognition technology—much of it in workers’ pockets.

City-issued iPhones equipped with Apple’s signature unlock feature, Face ID, were now illegal—even if the feature was turned off, says Lee Hepner, an aide to supervisor Aaron Peskin, the member of the local Board of Supervisors who spearheaded the ban.

Around the same time, police department staffers scurried to disable a facial recognition system for searching mug shots that was unknown to the public or Peskin’s office. The department called South Carolina’s DataWorks Plus and asked it to disable facial recognition software the city had acquired from the company, according to company vice president Todd Pastorini. Police in New York and Los Angeles use the same DataWorks software to search mug shot databases using photos of faces gathered from surveillance video and other sources.

The two incidents underscore how efforts to regulate facial recognition—enacted by a handful of cities and under consideration in Washington—will prove tricky given its many uses and how common it has become in consumer devices as well as surveillance systems. The technology, criticized as insufficiently accurate, particularly for people of color, is cheaper than ever and is becoming a standard feature of police departments.

Keep Reading The latest on artificial intelligence , from machine learning to computer vision and more

After SF's ban, nearby Oakland and Somerville, Massachusetts, adopted similar rules. As other cities join the movement, some are moving more carefully and exempting iPhones. A facial recognition ban passed by Brookline, Massachusetts, last week includes exemptions for personal devices used by city officials, out of concerns about both Face ID and tagging features on Facebook. The city of Alameda, in San Francisco Bay, is considering similar language in its own surveillance bill, which is modeled on San Francisco’s trend-setting legislation. “Each city is going to do it in their own way,” says Matt Cagle, an attorney at the ACLU of Northern California who has been working with cities considering bans. “There are going to be some devices that have [facial recognition] built in and they’re trying to figure out how to deal with that.”

On Tuesday, San Francisco supervisors voted to amend their law to allow the use of iPhones with Face ID. The amendments allow municipal agencies to obtain products with facial recognition features—including iPhones—so long as other features are deemed critically necessary and there are no viable alternatives. The ban on using facial recognition still applies. City workers are blocked from using Face ID, and must tap in passcodes.

When the surveillance law and facial recognition ban were proposed in late January, San Francisco police officials told Ars Technica that the department stopped testing facial recognition in 2017. The department didn’t publicly mention that it had contracted with DataWorks that same year to maintain a mug shot database and facial recognition software as well as a facial recognition server through summer 2020, nor did the department reveal that it was exploring an upgrade to the system.

WIRED learned details of the contract, and of the 2019 testing, through a public records request. OneZero previously published an email from DataWorks that claimed SFPD as a customer.

Records from the San Francisco Police Department related to facial recognition systems.

The documents WIRED obtained included an internal police department email—sent on the same day in January that the San Francisco ban was proposed—mentioning tests of a new facial recognition “engine.” Asked about the tests, department spokesperson Michael Andraychak acknowledged that SFPD had started a 90-day pilot of a new facial recognition engine in January, but said access to it was disabled after the trial ended. After the law banning facial recognition took effect in July, he said, SFPD “dismantled the facial recognition servers connected with DataWorks.”