A federal appeals court should outlaw the National Security Agency’s collection of millions of Americans’ telephone records, concentrating searches instead on terror suspects, civil liberties lawyers said in papers filed seeking a reversal of a lower-court judge who ruled the program was legal and necessary to fight terrorism.

Lawyers for the American Civil Liberties Union (ACLU) and the New York Civil Liberties Union submitted papers to the 2nd US Circuit Court of Appeals in Manhattan late Thursday, saying it is wrong that the NSA for more than a decade has kept a record of all phone calls made or received on major US telephone networks.

“Courts have insisted that the government’s intrusions on privacy be precise and discriminate,” the lawyers said. “The phone-records program is anything but. To pursue its limited goal of tracking the associations of a discrete number of suspected terrorists, the government has employed the most indiscriminate means possible – collecting everyone’s records.”

They said the First and Fourth Amendments were violated by a program that initiated widespread collection of phone records of Americans after the 11 September 2001, terrorist attacks, risking the discovery of telephonic associations Americans have in their family, political, professional, religious and intimate relationships.

The lawyers asked the appeals court to reverse a December ruling by US district judge William H Pauley III finding that the phone surveillance program was legal and a necessary tool for the government to stop terrorism.

“This blunt tool only works because it collects everything,” Pauley said. “The collection is broad, but the scope of counterterrorism investigations is unprecedented.”

US District Judge Richard Leon in Washington DC, had previously ruled that the program likely violates the U.S. Constitution’s ban on unreasonable search. The judge has since stayed the effect of his ruling, pending a government appeal.

The issue may ultimately be decided by the supreme court.

“Phone records reveal personal details and relationships that most people customarily and justifiably regard as private,” the civil liberties lawyers wrote. “The government’s dragnet collection of this information invades a reasonable expectation of privacy and constitutes a search.”

They said the law cannot allow such mass collection of private information “on the theory that some small fraction of the records may become useful to a factually predicated investigation in the future.”

And they added: “If Congress had intended to invest the government with the sweeping authority claimed here, it surely would have said so more directly.”

The authors of the U.S. Constitution intended that a neutral judge should stand between the government and its citizens, dictating specific instances when information can be obtained, the civil liberties lawyers said.

“Holding that the Fourth Amendment allows the government to search first and find suspicion later turns that principle on its head,” they wrote. They said the searches were only appropriate in regards to specific terrorism suspects.

The ACLU sued last year after former NSA analyst Edward Snowden leaked details of the secret programs. Pauley concluded the program was a necessary extension of security steps taken after the Sept. 11 attacks.

The government declined to comment Friday.