FORT MEADE, Md. — A military judge ordered prosecutors on Tuesday to turn over never-revealed details about the time a Guantánamo Bay detainee spent in secret C.I.A. prisons after his arrest in connection with the deadly attack on the destroyer Cole in Yemen.

The order was a victory for defense lawyers representing the detainee, Abd al-Rahim al-Nashiri, who is accused of orchestrating the Oct. 12, 2000, bombing of the Cole in Aden, Yemen. The attack killed 17 American sailors, wounded 42 others and tore a huge hole into the side of the ship.

Mr. Nashiri, who was born in Saudi Arabia, has been held at the United States military prison at Guantánamo Bay, Cuba, since 2006, after spending time at a series of secret C.I.A. prisons.

A C.I.A. inspector general’s report said Mr. Nashiri, considered to have once been one of the most senior leaders in Al Qaeda, was waterboarded and threatened with a gun and a power drill because interrogators believed he was withholding information about possible attacks against the United States. Such practices were allowed under rules approved by the George W. Bush administration, but many have since been repudiated.