Federal agents would have to get a judge's approval before using facial recognition to conduct surveillance of a criminal suspect under a bill introduced Thursday in the Senate.

The proposal is the first attempt by federal lawmakers to restrict law enforcement's use of the technology, which has become the subject of growing public opposition, with several U.S. cities banning its use by local authorities this year.

Sen. Chris Coons, D-Del., who sponsored the measure with Sen. Mike Lee, R-Utah, said it "strikes the right balance by making sure law enforcement has the tools necessary to keep us safe while also protecting fundamental Fourth Amendment privacy rights.”

The bill, known as the Facial Recognition Technology Warrant Act, would require federal law enforcement to explain to a judge why they want to use facial recognition to track someone in real time for longer than three days, and would limit that surveillance to 30 days. It also would require the judge to report the request to U.S. court administrators for tracking. And it would require law enforcement to work with government researchers to make sure the facial recognition systems they're using are accurate.

While the bill would make it more difficult to conduct real-time facial recognition surveillance ─ a technique that is not yet known to be used by law enforcement in America ─ the measure would not limit the way facial recognition is most commonly deployed: to identify a suspect from a photo or video still.

The bill only applies to federal law enforcement, not state and local police.

"It's an OK step," said Andrew Ferguson, a law professor at the University of the District of Columbia who has pressed lawmakers to regulate police use of facial recognition. "It addresses a problem that is not a problem yet, but it omits the problem that is currently in practice right now."

Facial recognition, which is driven by artificial intelligence, allows officers to compare images of people’s faces to photos in government databases — mugshots, jail booking records, driver’s licenses. Its use on still images has been embraced by dozens of police agencies, with officers using it to solve routine crimes and to quickly identify people they see as suspicious.

Critics warn that the technology could fuel an expansive surveillance state. Researchers have found that algorithms behind some of the facial recognition systems incorrectly identify women and people with dark skin more frequently than white men.

Researchers have also found that the FBI and U.S. Immigration and Customs Enforcement have routinely used state driver's license databases in facial recognition searches without license-holders' consent.

Microsoft, one of the biggest makers of facial recognition technology, said it supported the bill.

There are few laws or regulations governing how police use facial recognition or how much about it they must reveal to the public. Authorities in some cities have tried to keep it a secret. Because it's not used as evidence in court, the technique rarely shows up in public documents, and is rarely challenged by defense lawyers.

Ferguson said he'd like to see the bill expanded to include facial recognition on still images. Requiring a warrant for that common policing practice would do more to address concerns about the technology's accuracy ─ and secrecy over its use, Ferguson said. Police would have to explain to a judge why they need it, creating a public record and preventing "arbitrary and baseless searches," he said.