GUANTÁNAMO BAY, Cuba — It was May 2003, a year into the C.I.A. program that had led to three detainees being waterboarded hundreds of times in search of information about possible terror plots, and the agency needed to train more interrogators. At a classified prison in Afghanistan known as the Salt Pit, trainees took turns practicing "insult slaps and attention grabs" on a naked prisoner named Ammar al-Baluchi.
It was not supposed to work that way. The two psychologists who had set up the interrogation program that used waterboarding and violence and was authorized by the Bush administration had intended for interrogators to learn by trying out the techniques on each other. After that, they were to be paired with a certified interrogator as an apprentice.
"We had them practice on themselves so they would know what it felt like," James E. Mitchell, one of the contract psychologists, testified at Guantánamo last month during a pretrial hearing in the long-delayed trial over the Sept. 11, 2001 attacks. "We didn't have them practice on detainees."
C.I.A. personnel at the Salt Pit nonetheless chose to train on at least two prisoners, according to recently declassified accounts. About five trainees took turns slapping Mr. al-Baluchi, spinning him around and slamming his head into a wooden or cement wall, so a supervisor could observe and "then certify class member as interrogators," said a report on the training session read aloud during testimony in the war court.
Those accounts and others — which emerged in two weeks of recent testimony by Dr. Mitchell and his partner in developing the interrogation program, John Bruce Jessen — provide new details of what went on in the secret overseas prison network established after the 9/11 attacks. They showed that the interrogation program was more a test lab for unproven techniques than a well-regulated system, with rules made up or broken on the fly and its day-to-day operations afflicted by internal rivalries.
Across four years, the C.I.A. moved about 100 prisoners through 10 different sites from Afghanistan to Thailand, Poland, Morocco and Guantánamo — and kept them almost entirely in isolation and always out of reach of the International Committee of the Red Cross, which visits detainees and advocates their humane treatment.
During that period, the intelligence agency experimented with violence, nudity, isolation, sleep deprivation and psychological manipulation, sometimes going beyond the list of so-called enhanced interrogation techniques authorized by Bush administration lawyers.
In retrospect, the chief of the agency's Office of Medical Services wrote in 2007, the use of waterboarding was "little more than an amateurish experiment, with no reason at the outset to believe it would either be safe or effective," according to a report introduced last month in the court. Dr. Mitchell dismissed the criticism as a "mischaracterization of the entire process" by "a physician who didn't want people waterboarded."
The testimony also provided new details of how the black sites were staffed. There were career C.I.A. officers, who wore blue identification cards at the agency's headquarters in Langley, Va., and contractors, whose I.D. cards were green, in what Dr. Mitchell bitterly described as a two-tiered caste system. Even as the roles of Drs. Mitchell and Jessen expanded from psychologists acting as consultants in 2002 to interrogators to ultimately running an $81 million business that provided private guards and more interrogators, the "blue badgers" outranked the contractors.
At the black sites, they tested a range of practices including the use of "rectal rehydration" and "rectal feeding" on defiant detainees. To trick prisoners into spilling secrets about Al Qaeda, they devised elaborate "threat and rescue scenarios." To deprive detainees of sleep, they strung them up with chains.
For a time, the C.I.A. consolidated the prisoners in one site, still isolated from one another and unaware that they were not alone, Dr. Mitchell said. The purpose of this arrangement was to create an ever-ready "brain trust made up of senior terrorists" who could be questioned about photos or other intelligence tidbits, he said. He called the program the Terrorist Think Tank, or T3.
In one revealing illustration of how the psychologists saw the captives, Dr. Jessen looked over at two of the men accused of plotting the Sept. 11 attacks as they sat in court last month and remarked: "They've all grown up."
They were Walid bin Attash, who was 24 or 25 at his capture, and Ramzi bin al-Shibh, who was 30. At times in the black sites they were kept nude or put in adult diapers.
The threat-and-rescue schemes sounded like a Hollywood good-cop-bad-cop scenario. At the secret prison the United States ran in Thailand in 2002, one idea kicked around was to have the "bad cop" C.I.A. prepare a grave for the first prisoner of the program, a Palestinian known as Abu Zubaydah, and then have the "good cop" F.B.I. agents rescue him "before he was ever put in the hole," Dr. Mitchell testified.
It never happened. The C.I.A. retained custody of Mr. Zubaydah, and kept him incommunicado for the next four years. But a year later, in 2003, at a black site in Poland, or "Location No. 4" as it is called at the Guantánamo war court, the C.I.A. tried another approach, Dr. Mitchell said.
An interrogator walked Mr. bin al-Shibh past a room where a recently captured second prisoner, Khalid Shaikh Mohammed, was shackled, nude and undergoing "enhanced interrogation."
Dr. Mitchell did not specify what interrogation technique was being used on Mr. Mohammed or what Mr. bin al-Shibh saw. But it so upset Mr. bin al-Shibh, Dr. Mitchell said, that an interrogator walked him away from the room into the supposed safety of a hall closet. Dr. Mitchell said he opened the door to see Mr. bin al-Shibh in the lap of the interrogator, who was "kind of patting him like a child."
Dr. Mitchell warned the prisoner: "We may be coming for you next."
The idea was to see whether Mr. bin al-Shibh, who was captured six months earlier, could be frightened into disclosing information he had yet to share with his interrogators. Or, as Dr. Mitchell testified, "in case it stimulated his memory to reveal some things."
The interrogator whose lap Mr. bin al-Shibh sat on has never been publicly identified.
In his 2016 memoirs, "Enhanced Interrogation," Dr. Mitchell called the man "The Preacher," for another scenario he used to scare captives.
"At random times," Dr. Mitchell wrote, the interrogator would "put one hand on the forehead of a detainee, raise the other high in the air, and in a deep Southern drawl say things like, 'Can you feel it, son? Can you feel the spirit moving down my arm, into your body?'"
Dr. Mitchell portrayed himself as objecting to some of the other decisions he witnessed.
On a visit to the Salt Pit in Afghanistan in late 2002, he saw the C.I.A.'s chief of interrogations at the time, who has not been named in court proceedings, order guards to put a broomstick behind the knees of a Saudi prisoner and bend him backward, so his shoulder blades touched the floor.
Dr. Mitchell said he reported the chief of interrogations — who was removed from the role in 2003, then died the same year — for abuse of detainees.
Dr. Mitchell characterized his own use of waterboarding — something he had no experience with before he proposed its use in 2002 — as thoroughly approved by government lawyers. He said it was carried out in medically monitored and controlled situations and that psychologists like himself watched the behaviors of interrogators for "abusive drift."
By 2005, he and Dr. Jessen would be full partners in the black-site enterprise as sole-source private contractors employing C.I.A. trained guards and interrogators, generally former federal workers, through a no-bid $81 million contract.
He or Dr. Jessen were "bouncing around all over the world," as Dr. Mitchell put it, visiting black sites as part enforcers, part psychologists, carrying on conversations with the captives.
Sometimes they would drop by a prisoner's cell to explain how that day's debriefings would go, or intervene "when the detainee shut down," reminding a resisting prisoner that, if people at C.I.A. headquarters were unhappy, they could order a return to "the hard times."
Once the detainees were fulling cooperating, Dr. Mitchell testified, the psychologists set up their so-called Terrorist Think Tank at a black site by assembling certain high-value detainees, or H.V.D.s, in the same location without them knowing it.
"We could show a picture to one H.V.D. and ask them who that was, and we'd get their answer," he testified. The C.I.A would then show the same photo to other prisoners "down the hall" to see what they would say, he continued.
"We were able to very quickly and very rapidly get letters interpreted, get pictures identified, capture photos, identify places talked about, technical collections discussed, because they were all in one place," Dr. Mitchell testified.
To address concerns about the effects of isolation on the prisoners, Drs. Mitchell and Jessen had interrogators, including themselves, socialize with some of the prisoners by watching movies, eating or reading with them.
Dr. Mitchell said Mr. Mohammed — whom he and Dr. Jessen waterboarded 183 times — was allowed to teach a class to black-site workers. In his book, Dr. Mitchell said the idea came from "a forward thinking" chief of base of the C.I.A., who let Mr. Mohammed lecture on Islamic jihadist ideology and other topics — and that Dr. Mitchell attended the lecture.
Dr. Mitchell has repeatedly argued that the interrogation techniques, including those the trainees used on Mr. al-Baluchi, should have no long-lasting effects on the prisoners. Defense lawyers, by contrast, say that some of the men now have memory problems associated with traumatic brain injuries and sleep disorders from what was done to them in the black sites.
Mr. bin al-Shibh's defense lawyer, James P. Harrington, asked Dr. Mitchell whether there had ever been studies done on the long-term effects of the techniques, which were based on methods used to train American military pilots to resist torture.
"Not to my knowledge," Dr. Mitchell replied. "That would be human experimentation, and I believe that's against the law."