The National Security Agency headquarters in Fort Meade, Md. (AP)

An appeals court in Washington dealt a setback Friday to an activist’s lawsuit against the government over the legality of the National Security Agency’s call records program, ruling that the plaintiff has not proved his standing to sue.

A three-judge panel of the U.S. Court of Appeals for the District of Columbia Circuit ruled that ­public-interest lawyer Larry Klayman, the founder of Freedom Watch, has not proved that his own phone records were collected by the NSA — and so has not met a condition of bringing the lawsuit. It sent the case back to a lower court for further deliberation on the issue.

The panel’s ruling also reversed a ban on the NSA’s collection that had been imposed — and temporarily stayed — by a district court judge in December 2013.

The strictly procedural ruling does not address the constitutionality or legality of the program.

Congress in June put an end to the program, passing a law that bars the government from collecting phone data and other records in bulk. But the NSA is continuing to do so as it transitions the program to phone companies by December.

In Friday’s ruling, Circuit Court Judge Stephen F. Williams wrote that Klayman, a conservative legal activist, “lack[s] direct evidence” that records pertaining to his calls “have actually been collected.”

Klayman, the lead plaintiff in the suit, is a Verizon Wireless customer. The only phone company the government has acknowledged was part of the program is Verizon Business Network Services.

The Justice Department declined to comment on the case.

The panel’s ruling reverses the judgment of U.S. District Judge Richard J. Leon, who found that Klayman “demonstrated a substantial likelihood of success” in his bid to prove that his Fourth Amendment right to privacy was violated and that the NSA program was unconstitutional.

Leon’s fiery opinion drew wide attention not only because it was the first (and only) trial court to rule against the program but also because of its colorful, headline-grabbing language. He called the collection “almost-Orwellian” and “at best, the stuff of science fiction.”

Under the program, which was initiated in secret in 2001 under executive power and approved — again in secret — by a surveillance court in 2006, the NSA collects from a number of large phone companies the metadata of millions of phone calls daily. That includes numbers dialed and call times and durations, but not content.

The government confirmed the program’s existence in June 2013 after former NSA contractor Edward Snowden leaked a classified court order to Verizon Business Networks Services directing it to turn over “all call detail records” to the government.

Klayman lashed out at the judicial panel for its timing. “An ­ill-informed first-year law student could have written this within one day,” he said. “Why did you wait nearly two years after Leon issued his decision? You delayed getting to the issues. During that time the constitutional rights of Americans continue to be violated.”

He nonetheless said he was confident he will prevail. He said he could amend his complaint to include plaintiffs who are customers of Verizon Business Network Services. And he accused the panel of “reacting to the politics of the Washington Republican establishment . . . who say, ‘Do what you want, NSA.’ ”

He added: “Nobody’s against doing surveillance of terrorists. What we’re saying is get a warrant.”

To date, the only appeals court to rule on the merits of the NSA program is the U.S. Court of Appeals for the 2nd Circuit in New York, which in May held that the collection violated the Patriot Act and was “unprecedented and unwarranted.”

That court will hear arguments next week on the American Civil Liberties Union’s request that the NSA be required to end the collection immediately — not in December.

The court in Klayman’s case observed that his effort to prove standing was complicated by the possibility that the government could withhold information that would bolster his allegations. “Plaintiffs’ claims may well founder in that event,” said Circuit Court Judge Janice Rogers Brown. “But such is the nature of the government’s privileged control over certain classes of information.”

The ruling, said Harley Geiger, senior counsel for the Center for Democracy and Technology, “demonstrates that excessive secrecy limits debate and reform. It leads to unbalanced surveillance programs and provides victims with little or no recourse.”

At the end of the transition period, the NSA will be barred from collecting domestic phone records in bulk under the Patriot Act. Instead it will be required to obtain court approval to ask companies for phone numbers of individuals with suspected links to terrorism. The companies under court order will return to the agency metadata related to those calls and potentially calls linked to them.

Read more:

Foreign powers steal data on critical U.S. infrastructure, NSA chief says

Congressional action on NSA is a milestone in the post-9/11 world