This article was produced in partnership with the Pulitzer Center on Crisis Reporting.

GUANTÁNAMO BAY, Cuba — In the months after their arrival at Guantánamo in 2006 from years in C.I.A. detention, Khalid Shaikh Mohammed and the other accused plotters of the Sept. 11 attacks were guarded by a secret force disguised as United States troops and kept isolated in individual cells, unable to communicate with each other, a former commander testified Friday.

The account of their early days at Guantánamo emerged in a pretrial hearing on Friday in the case of Mr. Mohammed and four other men accused of conspiring in the 2001 attacks. The commander’s testimony amounted to the most comprehensive view yet of Guantánamo’s most mysterious prison, known as Camp 7, and the secret unit, called Task Force Platinum, that has guarded it since its inception.

Lawyers for Mr. Mohammed and the other defendants want the judge to exclude from their death-penalty trial, scheduled to start in January 2021, what they told F.B.I. agents in early 2007, months after they got to Guantánamo. The defense lawyers say those interrogations — carried out by what prosecutors say were “clean teams” from the F.B.I. who were unfamiliar with evidence unlawfully obtained from the defendants during the years they were in C.I.A. custody and subject to torture — were in fact tainted by years of clandestine C.I.A.-F.B.I. collaboration.

The defense lawyers argue that the prisoners provided the same answers to F.B.I. agents in 2007 that they had previously given to the C.I.A. at black sites where they were punished for not cooperating, and did not believe, based on conditions at Guantánamo, that they had free choice to refuse.