In a potentially major setback for the effort to prosecute five Guantánamo Bay detainees accused of aiding the Sept. 11, 2001, attacks, a military commission judge ruled on Friday that prosecutors may not use a key piece of evidence against the men: statements they made to F.B.I. interrogators shortly after their transfer out of the C.I.A.’s “black site” prisons nearly a dozen years ago.

The decision brought to a head a long-running and potentially irreconcilable tension in the case: Defense lawyers say they need to thoroughly investigate the torture of their clients at the hands of the C.I.A. for there to be a fair death penalty trial. But the government says there is a national security imperative to keep certain facts related to that period — like the identities of C.I.A. personnel who worked at certain prisons — secret.

The ruling centered on a fight over a technique the F.B.I. used to try to get statements out of the detainees — including Khalid Shaikh Mohammed, the self-described architect of the attacks — that could be used as courtroom evidence, despite their abuse in C.I.A. custody.

To attenuate that, the bureau sent in a “clean team,” whose agents did not know what the detainees had previously said, to start over with questioning them. But defense lawyers argue that the lingering effects of their clients’ previous torture tainted those interrogation sessions, too.