In a forceful rebuke of the government’s controversial collection of telephone metadata, a federal judge in Washington has ordered the National Security Agency to stop collecting bulk call information on two individuals and to destroy any metadata already collected about them.

US District Judge Richard Leon issued the temporary restraining order on Monday after concluding that the once-secret NSA intelligence-gathering mission almost certainly violates privacy guarantees of the Fourth Amendment.

In an abundance of caution, Judge Leon stayed his order pending an expected appeal by the government.

But the judge added: “I hereby give the Government fair notice that should my ruling be upheld, this order will go into effect forthwith.”

The ruling comes at a relatively early stage of a civil lawsuit charging the government with violating the US Constitution and the bounds of the Foreign Intelligence Surveillance Act.

The plaintiffs had asked the judge to temporarily order the government to stop its intelligence collection effort during the litigation. For the judge to issue such a temporary injunction, he must find a “significant likelihood” that the plaintiffs will ultimately win their case after it has been fully briefed and argued.

Although the case has only been presented in preliminary form at this stage, Judge Leon left little doubt about how he was inclined to rule later on the merits of the case.

“I cannot imagine a more indiscriminate and arbitrary invasion than this systematic and high-tech collection and retention of personal data on virtually every single citizen for purposes of querying and analyzing it without prior judicial approval,” Leon wrote in a 68-page opinion.

“Surely, such a program infringes on that degree of privacy that the Founders enshrined in the Fourth Amendment,” he said.

“Indeed, I have little doubt that the author of our Constitution, James Madison, who cautioned us to beware ‘the abridgement of freedom of the people by gradual and silent encroachment by those in power,’ would be aghast,” the judge wrote.

The lawsuit was among several suits filed in June following unauthorized disclosures about US government surveillance programs by former NSA contractor Edward Snowden.

Two of the suits were filed by Larry Klayman, an attorney and founder of the public interest group, Freedom Watch, and Charles Strange, the father of an NSA cryptologist who was killed in Afghanistan when his helicopter was shot down.

Judge Leon’s ruling focuses on the constitutional question of whether the secret collection of telephone metadata violates privacy protections of the Fourth Amendment.

He noted that the framers of the Constitution sought to protect the people, their houses, papers, and effects from “unreasonable searches and seizures,” particularly general warrants that authorized British authorities to search an entire house for incriminating evidence.

The Fourth Amendment requires a more focused search that is allowed only after authorities have convinced a neutral judge there is good reason to suspect wrongdoing.

In contrast, Leon said, the metadata collection program operates without any individualized suspicion of wrongdoing that might justify the search and storage of personal metadata.

“The threshold issue … is whether plaintiffs have a reasonable expectation of privacy that is violated when the Government indiscriminately collects their telephony metadata along with the metadata of hundreds of millions of other citizens without any particularized suspicion of wrongdoing, retains all of that metadata for five years, and then queries, analyzes, and investigates that data without prior judicial approval of the investigative targets,” Leon wrote.

Government lawyers maintain that American citizens have no expectation that information about their telephone usage will remain private. Once they make a phone call, the electronic signals released into the system belong to the system and are no longer private, they argue.

“I disagree,” the judge said.

“I believe that bulk telephony metadata collection and analysis almost certainly does violate a reasonable expectation of privacy,” he said.

The judge said the government was relying on a Supreme Court precedent involving outdated surveillance methods.

“Thirty-four years ago, when people wanted to send ‘text messages,’ they wrote letters and attached postage stamps,” he said.

In 2013, he noted, people have an entirely different relationship with phones. “This rapid and monumental shift towards a cell phone-centric culture means that the metadata from each person’s phone reflects a wealth of detail about their familial, political, professional, religious, and sexual associations,” he wrote.

“Records that once would have revealed a few scattered tiles of information about a person now reveal an entire mosaic – a vibrant and constantly updating picture of the person’s life,” the judge said.

The opinion won immediate praise from civil libertarians.

“Judge Leon’s ruling gives Fourth Amendment case law a long overdue update,” said Elizabeth Goitein of the Brennan Center for Justice.

“Americans have always had a reasonable expectation of privacy in their associations and beliefs. Today, this kind of information is easily revealed through computer analysis of bulk telephone records,” Ms. Goitein said. “This ruling brings the law in line with technology.”

Jameel Jaffer, deputy legal director of the American Civil Liberties Union, said the judge exposed the government’s legal justification of the data collection as inadequate and out of date.

“As Judge Leon notes, the government’s defense of the program has relied almost entirely on a 30-year-old case that involved surveillance of a specific criminal suspect over a period of two days,” Mr. Jaffer said.

“The idea that this narrow precedent authorizes the government to place every American under permanent surveillance is preposterous,” he said.

The case is Klayman v. Obama (13-851).