“I M W KSM.”

So went the electrifying text message received by a C.I.A. operative in Islamabad, Pakistan, in February of 2003, sent by a mysterious man known as Asset X. The note confirmed what Asset X, whose real identity is an official secret, had been telling his C.I.A. handlers for months: that he could lead them to Khalid Sheikh Mohammed, a senior Al Qaeda leader and the suspected mastermind of the 9/11 attacks. K.S.M., as he later came to be known in the West, was still at large, and the C.I.A. wanted him almost as badly as they wanted Osama bin Laden.

Within hours of the operative receiving the text message, C.I.A. and Pakistani intelligence officers followed Asset X’s lead, swooped into the compound where Mohammed was living, and captured him. The takedown of Mohammed had almost fallen apart several times, thanks to C.I.A. mismanagement of Asset X. Just as remarkable is how his capture was later used to justify the most brutal aspects of the C.I.A.’s special interrogation program that was put in place after the 9/11 attacks.

Soon after his capture in Rawalpindi, on March 1, 2003, Mohammed was spirited to secret C.I.A. prisons in Afghanistan and Poland, where his interrogators went straight to brutality: slamming him against a wall (a practice known as “walling”), depriving him of sleep (at one point for more than a week), forcing him to stand or crouch in painful positions, stripping him during questioning, and engaging in a bizarre practice called “rectal rehydration.” (According to a C.I.A. document, it was supposed to help “clear a person’s head.”) In Poland, the interrogators subjected Mohammed to waterboarding, a form of torture that makes a person believe he is drowning, at least a hundred and eighty-three times.

The details of Mohammed’s interrogation, described in the report issued earlier this month by the Senate Select Committee on Intelligence, make for grim, even sickening reading. During Mohammed’s waterboarding sessions, C.I.A. officers reported that he “yelled and twisted,” “seemed to lose control,” and became “somewhat frantic.” The purpose of the waterboarding appears to have been to bring Mohammed as close as possible to death without actually killing him. As one C.I.A. medical officer who presided over the torture wrote, “In the new technique we are basically doing a series of near drownings.”

On March 12, 2003, during a waterboarding session, so much water was forced into Mohammed that his “abdomen was somewhat distended and he expressed water when the abdomen was pressed,” the Senate report says, quoting from a C.I.A. cable. One of the medical officers present said that, even though Mohammed was vomiting during the sessions, his “gastric contents” had become so diluted that he was “not concerned about regurgitated gastric acid damaging KSM’s esophagus.” Instead, the medical officer said, he was worried that Mohammed had been filled with so much water that there was a danger that the electrolytes in his blood had become dangerously diluted; the officer requested that C.I.A. interrogators use salted water during the waterboarding sessions.

The Senate report, which drew almost entirely on the C.I.A.’s internal communications, makes a convincing case that while the interrogation of Mohammed produced some valuable information, the interrogators never got what they wanted. No information provided by Mohammed led directly to the capture of a terrorist or the disruption of a terrorist plot.

Here are some quotations from C.I.A. records filed during Mohammed’s interrogation:

“Overall view seems to be” that waterboarding “is not working in gaining KSM[’s] compliance,” one officer wrote.

“Against KSM it has proven ineffective,” the deputy chief of the C.I.A. interrogation program wrote. “The potential for physical harm is far greater with the waterboard than with the other techniques, bringing into question the issue of risk vs. gain.”

“We seem to have lost ground,” the deputy chief continued, writing that the practice “may poison the well.”

An official C.I.A. assessment of the interrogations concluded that Mohammed managed to conceal his most valuable information, despite being tortured. (The report was titled “Precious Truths, Surrounded by a Bodyguard of Lies.”) Another report, written after the waterboarding sessions had ended, said that interrogators “remain[ed] highly suspicious that KSM is withholding, exaggerating, misdirecting, or outright fabricating information” on weapons of mass destruction. “Pretend cooperation,’’ another report said. “May never be forthcoming or honest,” said another.

The C.I.A. subjected Mohammed to waterboarding and other “enhanced methods” for about four weeks. The last day was March 25, 2003. It’s not clear, from the Senate report, why they stopped, but given the cables, it’s a good bet that many in the C.I.A. had concluded that torture wasn’t working.

Mohammed did reveal some fascinating information after the torture ended. For instance, more than a week after the waterboarding was over, Mohammed told his interrogators that he had been with Ayman al-Zawahiri, the current leader of Al Qaeda, the day before his capture. (This doesn’t necessarily mean that torture didn’t work, of course; it’s possible that Mohammed was relieved that it had stopped and was grateful to his interrogators.)

Mohammed also claimed that much of the information he had given under torture was false, and in at least several instances that turned out to be correct. The most disturbing incident happened on March 21, 2003, after the C.I.A. had received a report from another detainee that Mohammed had considered using a group of African-American Muslims who were training in Al Qaeda camps in Afghanistan to possibly carry out attacks on gas stations in the United States. Mohammed, the other detainee said, wanted to recruit Muslims in the U.S. to help the group. According to the Senate report, a C.I.A. supervisor misread the information from the other detainee to conclude that Mohammed had already recruited individuals inside the U.S. The supervisor wanted Mohammed to say who these individuals were. “Mukie [Mohammed] is going to be hatin’ life on this one,’’ the supervisor wrote.

At first, under interrogation, Mohammed “flatly denied” that he had tried to recruit African-American Muslims in the U.S. for such an operation. But after further waterboarding sessions, he declared that he was “ready to talk” and told a detailed story about how he had sent an Al Qaeda operative, named Abu Issa al-Britani, to Montana to recruit African-American Muslim converts. In June, more than two months after the waterboarding had stopped, Mohammed told the C.I.A. that he had fabricated the story. According to the agency’s own records, Mohammed explained that he was “under ‘enhanced measures’ when he made these claims and simply told his interrogators what he thought they wanted to hear.”

Just as troubling as Mohammed’s torture is the story the C.I.A. told about his capture. In April, 2007, Michael Hayden, then the director of the C.I.A., testified before the Senate Intelligence Committee that another senior Al Qaeda operative, Abu Zubaydah, who was captured in 2002 and tortured, had led the C.I.A. to Mohammed. “Until that time, KSM did not even appear in our chart of key al-Qa’ida members and associates,” Hayden said.

President George W. Bush had made a similar claim in 2006. Bush said that Abu Zubaydah and another Al Qaeda planner who was tortured, Ramzi bin al-Shibh, had provided information that “helped in the planning and execution of the operation that captured Khalid Sheikh Mohammed.”