SALT LAKE CITY (AP) — A federal judge was weighing Thursday whether the Drug Enforcement Administration can access a Utah prescription-drug database without a warrant in a lawsuit that pits the right to privacy against the need to combat the country's opioid-drug epidemic.

"I think this is a fascinating case," said U.S. District Judge David Nuffer. He's considering whether to follow another judge's recommendation that sided with the DEA.

The agency is fighting to be exempt from a Utah law that requires investigators to get a warrant to search the database. The DEA says it's an important tool early in their investigations.

But the American Civil Liberties Union of Utah and the state's attorney general argue that warrantless searches of the database violate people's privacy rights.

It holds records of painkiller prescriptions and orders for medication like the anti-anxiety drug Xanax and the sleep aid Ambien. Almost all states maintain similar databases. Utah is among a minority where state law requires a warrant.

U.S. Magistrate Judge Dustin Pead has sided with the DEA, saying the information is already in government hands and withholding it would be like local police forcing the federal government to get a warrant for police reports. The ACLU says it's more like federal investigators asking for the contents of students' private emails.

Nuffer said in a draft ruling that he's also leaning toward agreeing with the DEA, though he hasn't yet made a final decision.

A separate federal appeals court also sided with the DEA in a case involving a similar database in Oregon, though the panel didn't resolve the question of whether the DEA subpoenas violate constitutional protections against unreasonable search and seizure.

Utah's law was passed after two firefighters said they were wrongly charged with prescription drug fraud after a wide-ranging search of the database in an investigation into ambulance drug thefts. The two men were not linked to the thefts, but their relatively high number of prescriptions raised suspicion and prosecutors filed fraud charges. The case was later dropped, but still put their careers and personal lives at risk, they said.

The Utah firefighters union and a state gay-rights group joined the ACLU in the lawsuit.

The firefighters' union said it is sympathetic to the need to curb a nationwide problem with prescription drug abuse, but that police shouldn't have unfettered access.

The group Equality Utah, meanwhile, argued the searches violate the privacy of transgender people whose hormone medications are recorded in the database.