The military judge in the U.S.S. Cole bombing case on Friday threw out confessions the Saudi defendant had made to federal agents at Guantánamo Bay after years of secret imprisonment by the C.I.A., declaring the statements the product of torture.

The decision deprives prosecutors of a key piece of evidence against Abd al-Rahim al-Nashiri, 58, in the longest-running death-penalty case at Guantánamo Bay. He is accused of orchestrating Al Qaeda’s suicide bombing of the warship on Oct. 12, 2000, in Yemen’s Aden Harbor that killed 17 U.S. sailors.

“Exclusion of such evidence is not without societal costs,” the judge, Col. Lanny J. Acosta Jr., wrote in a 50-page decision. “However, permitting the admission of evidence obtained by or derived from torture by the same government that seeks to prosecute and execute the accused may have even greater societal costs.”

The question of whether the confessions were admissible had been seen as a crucial test of a more than decade-long joint effort by the Justice and Defense Departments to prosecute accused architects of Qaeda attacks. The special Guantánamo court is designed to grapple with the impact of earlier, violent C.I.A. interrogations on war crimes trial, including death-penalty cases.