The U.S. government amassed a secret law enforcement database of Americans’ outbound overseas telephone calls through administrative subpoenas issued to multiple phone companies for more than a decade, according to officials and a government affidavit made public Thursday.

The existence of the database was made known at the order of U.S. District Judge Rudolph Contreras of Washington, presiding over the case of a U.S.-Iranian dual national who is accused of unlawfully exporting non-military technology to Iran.

Civil liberties groups and attorneys for the defendant, Shantia Hassanshahi, called the database a sweeping overreach of a 1988 provision of the Controlled Substances Act, aimed at drug enforcement.

According to Robert Patterson, assistant special agent in charge at the Drug Enforcement Administration, until 2013 American law enforcement officials periodically asked an unspecified number of U.S. telecommunications service providers for phone record metadata — specifically originating and receiving telephone numbers and the date, time and length of calls — for outbound U.S. calls dialed to countries “determined to have a demonstrated nexus to international drug trafficking and related criminal activities.”

Patterson, in the lightly redacted affidavit, does not state the number of countries involved but includes Iran. The affidavit states the database was suspended in September 2013 but does not say why. One individual familiar with the program said the newly disclosed program had been running since the 1990s.

Justice Department spokesman Patrick Rodenbush said the program, which he did not name, was “ultimately terminated. It has not been active nor searchable since September 2013, and all of the information has been deleted.”

Rodenbush declined to state whether the DEA was collecting bulk communications data in other forms.

The New York Times reported in September 2013 that for at least the previous six years, law enforcement counternarcotics officials had routine access to an AT&T database of all calls made through its switches dating to 1987 through the use of so-called administrative subpoenas in what was called the Hemisphere Project. That separate database reportedly adds 4 billion records per day.

In August 2013, Reuters described the DEA Special Operations Division’s pursuit of drug dealers, money launderers and other criminals through a database called DICE, which reportedly consisted of about 1 billion records, mostly phone log data legally gathered through “subpoenas or search warrants.”

Unlike court subpoenas or search warrants, however, administrative subpoenas do not require involvement from prosecutors, grand juries or a judge but can be issued directly by law enforcement.

The National Security Agency collects daily from U.S. carriers the metadata of millions of Americans’ phone calls — time, date and duration, but not the content — under a program overseen by the Foreign Intelligence Surveillance Court. The program was disclosed by former NSA contractor Edward Snowden in June 2013 and sparked a national debate about the proper scope of government surveillance.

Subpoena powers “will be used judiciously and with appropriate restraint,” the report said, quoting the DEA Agents Manual.

Hassanshahi pleaded not guilty after he was arrested in 2013 in Los Angeles after agents said they used the database to trace a call to Iran to a phone linked to him.

He was identified through the database by a Department of Homeland Security agency, Immigration and Customs Enforcement’s Homeland Security Investigations.

The DEA affidavit said the database could be queried when officials “had a reasonable articulable suspicion” that a phone number “was related to an ongoing federal criminal investigation.”

In an interview, Hassanshahi’s attorney, Saied Kashani, said, “The government has converted the war on drugs into a war on privacy.”

“They’ve used a statute, which is designed for limited subpoenas to get information about drug trafficking, and used it to gather routinely and monthly records of every phone call placed by every American [to someone] overseas, and then they’re making this information available secretly to every other government agency,” Kashani said.

Michael German, a fellow with the Brennan Center for Justice, said it was disturbing to see “the DEA basically mirroring a very closely regulated program on the national security side, without the same regulations and oversight.”