Police used Google location data to find an accused bank robber. He says that's illegal.

Jon Schuppe
The Google search application is seen running on an iPhone on September 5, 2018.
Jaap Jurriens | NurPhoto | Getty Images

Just before 5 p.m. on May 20, a gunman walked into a bank in Midlothian, Virginia, forced a worker to open a safe and fled with $195,000. Security footage showed the man holding a cellphone to his ear just before the robbery, a detail that led police to attempt a surveillance technique that is growing in popularity among American law enforcement agencies.

When authorities had not identified the suspect a few weeks after the robbery, an officer got a warrant for Google's location data from all the cellphones that had been in the area of the Call Federal Credit Union bank during the heist. Starting from a list of 19 accounts, investigators narrowed their search to a 24-year-old Richmond man named Okello Chatrie, whom they eventually charged with armed robbery.

More from NBC News here:

Microsoft hires Eric Holder to audit AnyVision over use of facial recognition on Palestinians

Why did Microsoft fund an Israeli firm that surveils West Bank Palestinians?

Google's 'Project Dragonfly' censored search engine triggers protests

The demand for Google data, known as a geofence warrant, is a way for law enforcement authorities to take advantage of the company's collection of massive amounts of information on its customers. The orders allow police to track just about anyone using an Android device or a company app — such as Google maps or Gmail — to a particular place over a particular time period. As more police use such warrants, the method is raising concerns among privacy advocates, who say the government is gathering information from people in violation of the Fourth Amendment, which guards against unreasonable searches.

That is what Chatrie's lawyers are now arguing, in what may be the first case in which a defendant is fighting the use of a geofence warrant to charge him with a crime.

"It is the digital equivalent of searching every home in the neighborhood of a reported burglary, or searching the bags of every person walking along Broadway because of a theft in Times Square," Chatrie's lawyers said in an October court filing. "Without the name or number of a single suspect, and without ever demonstrating any likelihood that Google even has data connected to a crime, law enforcement invades the privacy of tens or hundreds or thousands of individuals, just because they were in the area."

Prosecutors say that the search was legal because Chatrie had opted into Google's location services, allowing his Android phone and the company's apps to track his movements. And they say police avoided collecting personal information from people unconnected to the robbery.

"The geofence warrant allowed them to solve the crime and protect the public by examining a remarkably limited and focused set of records from Google," prosecutors wrote in a response, filed Tuesday.

Chatrie has pleaded not guilty and is awaiting trial.

The use of geofence warrants seems to be increasing, according to defense lawyers and privacy advocates. There is no easy way to track them, but they have been documented in cases in North Carolina, Minnesota, Virginia, Arizona and elsewhere. Contractors now offer to help police looking to use the warrants.

Google did not immediately comment. Its transparency reports show that the number of search warrants sent to the company more than doubled in the past two years, to 19,046 from July 2018 to June 2019.