Police say facial recognition is “essential” and “imperative” — a groundbreaking tool that allows them to track down criminals who would otherwise escape justice.

Opponents say the technology is “nefarious” and “dangerous” — an omen of repressive government surveillance.

The two sides are engaged in an escalating battle over public opinion that will reach a turning point this week, when San Francisco is expected to become the first city in the country to adopt a ban on government use of facial recognition.

Other cities in the Bay Area, including Oakland and Berkeley, along with Somerville, Massachusetts, could follow later this year. State lawmakers in Massachusetts will soon begin debating whether to enact a statewide moratorium on the technology. A bill in New York proposes a temporary stop to facial recognition in public schools, which some see as a first step toward a wider prohibition. Same with a California bill that aims to prohibit facial recognition from being linked to police body cameras.

The proposed bans have injected new momentum into a campaign by civil rights advocates, defense lawyers and artificial intelligence researchers to expose the flaws of facial recognition to lawmakers and the public. Linking the fight with a broader public backlash against the government and tech firms’ use of private data, the opponents have documented how algorithms that drive the systems are prone to misidentifying people with dark skin. Last week, researchers at Georgetown Law School released reports outlining police abuses of facial recognition and the ability of some big-city departments to use surveillance camera networks to identify people in public spaces in real time. On Wednesday, Amazon shareholders will consider proposals, pushed by activist investors, aimed at curtailing the company’s selling of its facial recognition to the government.

But law enforcement officials and the companies that develop facial recognition systems say the opponents are misinforming the public by emphasizing the technology’s shortcomings and overlooking its benefits. They are trying to counteract the critics with a stronger effort to explain why the technology can boost safety.

Hundreds of American police agencies already have access to facial recognition, with many using it to help identify suspects in routine crimes, from shootings to thefts. But very few of them talk about it openly. That has arguably allowed stories of misuse to dominate the debate.

“This is an area where our traditional secrecy and lack of transparency has probably come back to haunt us,” said Jim Burch, president of the National Police Foundation, which helps police departments adopt new technology, including facial recognition.

“The solution,” he added, “would be to better inform people and make them aware of why it should be done and how to do it in the safest and smartest ways.”

That effort is underway, said Benji Hutchinson, vice president of federal operations at NEC Corporation of America, one of the largest suppliers of facial recognition systems to law enforcement. The company has sent representatives to talk to federal lawmakers to explain how the technology works.

“There’s going to be an interesting discussion that we’re going to see play out in the next six, 12, 18 months as this technology is used in more places around the country,” Hutchinson said.

There are no pending bills in Congress to regulate the government’s use of facial recognition.

Opponents of facial recognition believe they have built a model to fight the technology. It is rooted in a movement that began six years ago in Oakland, California, in response to discovery of the city’s plans to create a massive surveillance network of video cameras, gunshot detectors and license plate readers. The plan was scrapped amid a public backlash, and led to the creation of a privacy commission that, with support from the American Civil Liberties Union of Northern California, backed the passage of a local law requiring the city to submit for public scrutiny any purchase of surveillance equipment. Oakland now has a pending amendment to that law that would ban the city government from using facial recognition.

In 2016, the American Civil Liberties Union launched a national campaign to pass surveillance-transparency bills. Eleven local governments, including cities in California, Ohio and Massachusetts, have done so. Many included language written by the ACLU in their measures. More than a dozen other cities are considering doing the same, the group says.

The ACLU has also written model legislation for local governments specifically focused on banning facial recognition.

Matt Cagle, an attorney at the ACLU of Northern California, was among the leaders of the campaign to ban facial recognition in San Francisco, which began last fall. Although the city is a hub for the nation’s technology industry, it also has a history of advocacy for civil liberties. A varied group of community organizations — representing immigrants, the LGBTQ community, Muslims, Asian Americans, the homeless and defense lawyers — joined the effort.

“Communities should be able to decide how governments conduct surveillance,” Cagle said. “And the public can decide to take it off the table.”

That approach will be used elsewhere.

Lawmakers in Somerville, Massachusetts, used the ACLU’s model legislation as a guide for its pending ban on its local government’s use of the technology.

“I understand that some may view this as an extreme step,” said Ben Ewen-Campen, the Somerville city councilor who sponsored the proposed ban, which he said could come up for a vote this summer. “I view this as we are finally stepping in and saying this technology is moving at a pace the public is not ready for, and it’s time to have that conversation with the public.”

Tech firms and some police agencies say they aren’t against stronger checks on government surveillance, including measures that require agencies to publicly explain how they would use the technology they want to buy. Rather than impose bans on facial recognition, it would be appropriate to adopt guardrails that allow police to continue using it while avoiding mass surveillance, they say.

“This is not the first and it’s not going to be last technology that has both promise and peril associated with it,” Burch said. “But to react in this way and shut out the technology and the potential for good that could come from it is concerning.”

CORRECTION (May 22, 2019, 3:09 p.m. ET): An earlier version of this article incorrectly described the timeline of the ACLU’s national campaign to pass local government transparency bills. The campaign began in 2016; it did not follow the 2018 passage of the transparency bill in Oakland.