WASHINGTON, Nov. 16 — A federal appeals court said today that secrecy laws forced it to exclude critical evidence about the National Security Agency’s domestic eavesdropping program from being used by an Islamic charity in a lawsuit even though the mere existence of the program could no longer be considered a “state secret.”

The complex ruling was a victory for the Bush administration and signaled trouble for civil rights groups that are trying to show that the eavesdropping program was unconstitutional and to hold telecommunications companies liable for carrying it out.

The Al-Haramain Islamic Foundation, a charity in Oregon, had perhaps the best evidence of anyone that it had been a target of the wiretapping program, based on a top secret document mistakenly given to the group in 2004.

But the ruling by the United States Court of Appeals for the Ninth Circuit, based in San Francisco, found that evidence about the document could not be introduced in court because it fell under the “state secrets” privilege invoked by the government. The court, reversing a lower court ruling, said the trial judge had made “a commendable effort to thread the needle” but that its final ruling in allowing the evidence was flawed.