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

GUANTÁNAMO BAY, Cuba — After 183 rounds of waterboarding, Khalid Shaikh Mohammed, the man accused of plotting the Sept. 11, 2001, attacks, spent his years in C.I.A. detention as a charming captive who dabbled in Islamic mysticism and engaged in pleasantries with the psychologist who waterboarded him, that psychologist told a war crimes prosecutor on Thursday.

James E. Mitchell, who as a contractor for the C.I.A. helped develop the agency’s interrogation program and handled all the waterboarding, said Mr. Mohammed managed so well in his last three years in the secret prisons after the violent questioning had ended that the two men would sit and hold hands, as Middle Eastern men sometimes do.

He said Mr. Mohammed put on a “charm initiative” and described him as a well-adjusted detainee who never expressed fear of him, gave the psychologist a nickname, “Abu Captain,” and sought his help in improving his conditions as he was moved through the different C.I.A. black sites.

Mr. Mohammed’s lawyer rejected Dr. Mitchell’s account, saying his client was motivated by fear in dealing with the psychologist.