Baltimore police have used a cell phone-tracking device known as a "stingray" thousands of times in recent years, a detective revealed in court testimony Wednesday.

At the same time, the department was withholding information about the device from prosecutors and judges – as instructed by the FBI.

The technology was largely unknown to the public until recently. Privacy advocates nationwide have questioned whether there is proper oversight of its use, which some say is tantamount to warrantless spying.

The controversial device simulates a cell phone tower, forcing mobile phones in the area to connect with it, thereby enabling police to collect data and track people – even those not suspected of a crime.

Last fall, a Baltimore police detective refused to answer questions about the device in court, citing a nondisclosure agreement with federal authorities. After the judge threatened to hold him in contempt if he refused to provide information, prosecutors withdrew the evidence.

A copy of that agreement, obtained by the Baltimore Sun, explicitly instructs prosecutors to drop cases if pressed on the technology, and tells them to contact the FBI if legislators or judges ask questions.

Detective Emmanuel Cabreja, a member of the Police Department's Advanced Technical Team, testified that police own a Hailstorm cell site simulator – the latest version of the stingray – and have used the device 4,300 times since 2007, the Baltimore Sun reported.

Cabreja said he had used it 600 to 800 times in less than two years as a member of the unit.

American Civil Liberties Union attorney Nate Wessler told the Baltimore Sun that 4,300 uses is a "huge number."

For comparison, the Florida Department of Law Enforcement said its officers have used the device about 1,800 times. Police in Tallahassee say they have used it more than 250 times; police in Tacoma, Washington, 170 times.

Cabreja, the police detective, brought a copy of the nondisclosure agreement to court, which was dated July 2011 and bore the signatures of then-Police Commissioner Frederick H. Bealefeld III and then-State's Attorney Gregg Bernstein.

The signatories to the document agree that disclosing the existence of the stingray could allow suspects to avoid detection, as well as compromise the FBI’s ability to protect the public from terrorism.

The signatories agreed that if they receive a public records request or an inquiry from judges or legislators, they will notify the FBI immediately to allow "sufficient time for the FBI to intervene."

In the case Cebreja was investigating, police were targeting a Verizon phone, so identifying information from every Verizon customer in the area was collected, but "not seen," the detective said. Police used the stingray to strengthen the target phone’s signal so they could track it more easily.

Detectives traced the phone to a group home, where they told a woman who answered the door that they were conducting a general criminal investigation. After the woman allowed the seven detectives inside the home, they used the stingray to make the phone ring before anyone else in the house knew they were there.

"If they can increase the signal strength of your phone or make it ring, they can pretty much make it do anything," said Joshua Insley, the defense attorney in the case Cabreja investigated.

He added that police receive authorization to use the tracking devices by "basically duping these judges into signing authorizations to use stingrays."

The eagerness of federal authorities to hide details about the technology has been a saving grace for suspects who have been offered favorable plea deals by prosecutors wanting to end any in-court debate about the stingray.

Following Cabreja's testimony, prosecutors and defense attorneys entered into plea negotiations.