Headley, a 52-year-old businessman and former U.S. drug informant, avoided the death penalty by confessing that he did surveillance for both plots and by cooperating extensively with investigators after his arrest in October 2009.

Headley revealed startling evidence that Pakistan’s Inter-Services Intelligence Directorate (ISI), played a central role with the Lashkar-i-Taiba militant group in the attacks. His testimony enabled U.S. prosecutors to indict Lashkar masterminds and a major in the ISI, Pakistan’s spy agency, on charges that include aiding the murder of U.S. citizens in India.

As a result of Headley’s cooperation, former U.S. Attorney Patrick Fitzgerald of Chicago — who is now in private practice — took the unusual step Thursday of appearing in the courtroom to ask the judge for a sentence of 30 to 35 years rather than life under a plea arrangement.

Fitzgerald, a veteran counterterror prosecutor, interviewed Headley in person after his arrest and negotiated the plea bargain. Fitzgerald praised the speed and thoroughness of Headley’s cooperation, noting that Headley kept talking even after being told he faced the death penalty.

Nonetheless, U.S. District Court Judge Harry Leinenweber made his distaste for Headley clear. In addition to citing the horrific nature of the three-day slaughter in Mumbai, the judge pointed out that Headley previously received two generous plea bargains when he was charged with heroin trafficking in the 1980 and 1990s.

“I don’t have any faith in Mr. Headley when he says he’s a changed person committed to the American way of life,” Leinenweber said. “I hope the sentence I impose will keep him under lock and key for the rest of his natural life.”

Headley must serve at least 85 percent of the sentence, which means he will not be released until he is in his late 70s at the earliest. Still, the government’s treatment of Headley has stirred criticism from victims of Mumbai, from the Indian public and from lawyers for an accomplice, Tahawwur Rana, who was sentenced to 14 years last week.

Those sentiments were summed up in a vivid, emotional statement in the courtroom by Linda Ragsdale, an American victim of the Mumbai attacks. Ragsdale spoke just a few feet from the tall, balding Headley, who wore a gray sweat suit and listened impassively.

Ragsdale suffered severe gunshot wounds when gunmen burst into the Oberoi Hotel in Mumbai as she was dining, unleashing a fusillade with AK47s and grenades.

Ragsdale wept as she described hiding under a table with a 58-year-old father and his 13-year-old daughter, Alan and Naomi Scherr of Virginia, and seeing them both die. She read a statement to the judge from Kia Scherr, the wife and mother of the victims.

“It would be an appalling dishonor if he only gets 35 years,” Kia Scherr said in the statement. “It would not do justice for this crime.”

Ragsdale told the court that the attack left her with a 3-foot-long scar and physical pain that is sometimes unbearable. While she and the others suffered in Mumbai, Headley watched the attack on TV at his home in Pakistan, she said. In fact, testimony revealed that as Headley watched, he received congratulatory messages from fellow plotters and his wife in Chicago. (Headley’s wife has not been charged.)

“I know what a bullet can do to every part of a human body,” Ragsdale said. “I know the sound of life leaving a 13-year-old child u2026 We faced all this while you faced a TV screen.”

Headley, the wealthy son of a Pakistani father and American mother, did not make a statement. Western and Indian investigators consider him a uniquely skilled and dangerous terrorist because he received training and direction from the ISI spy agency as well as Lashkar and al Qaeda.

He used his charm, language skills and American passport to conduct meticulous undercover reconnaissance, posing as an immigration consultant, in India, Denmark and elsewhere. Investigators say the Mumbai attacks were successful because of his scouting combined with the funding, planning and expertise provided by the ISI in pulling off one of the most devastating and sophisticated plots since 9/11.

Pakistan has denied any link to the attacks.

Lashkar and the ISI followed up Mumbai by launching Headley on a plot to attack a Danish newspaper that had published cartoons of the prophet Mohamed. The sponsorship of the plot then shifted to al Qaeda. Headley was arrested as he prepared a third surveillance trip to Denmark.

Asked Thursday whether Pakistan has made any effort to arrest the accused masterminds, Gary S. Shapiro, acting U.S. attorney in the Northern District of Illinois, said: “I have no idea.”

A U.S. counterterror official, who is familiar with the case and who requested anonymity, said this week that he knew the answer to the question.

“No one is looking for them in Pakistan,” the U.S. counterterror official said.

U.S. prosecutors defended the sentence. They said recruiting witnesses like Headley is a key to prosecutions of complex international conspiracies.

Shapiro said the word “despicable” did not begin to describe the Mumbai attacks, but he added: “We need witnesses. The only way you get witnesses in this world is to threaten them with prosecution and then offer them an incentive to cooperate.”

Although tracking down the Pakistani masterminds seems hopeless, Shapiro said, he noted cases in which once-invincible Colombian and Mexican drug lords have been brought to justice.

Headley’s sentencing did not answer questions that have dogged the U.S. government, particularly why the FBI and other agencies did not respond more aggressively to six warnings from Headley’s wives and associates about his terrorist activities between 2001 and 2008.

Many Indian officials — and some Western ones — think the Mumbai attacks could have been averted if Headley had been questioned, arrested or placed under surveillance as the result of one of the brief FBI inquiries that were opened after those warnings.

Moreover, the FBI, U.S. Drug Enforcement Administration and other agencies have not fully explained the extent of Headley’s work as a DEA informant, especially in 2001 when he began gathering intelligence on Islamic extremists as well as drug traffickers.

The DEA says he was deactivated as an informant in early 2002 as he began training with Lashkar. Other U.S. agencies say he remained a DEA informant in some capacity until at least 2005. And Indian officials allege that he remained a U.S. agent later than that.

Finally, authorities have not explained why it took almost a year to arrest Headley after the Mumbai attacks. Days after, an associate of Headley’s mother came forward to tell FBI agents in Philadelphia she believed he was involved with Lashkar, the group behind the assault.

The FBI has admitted that agents then discovered that Headley had been the subject of repeated previous allegations of terrorism involvement. Nonetheless, agents failed to find Headley in Chicago, and he returned to India and Europe for new terrorist reconnaissance.

It took the FBI until July of 2009, when British intelligence detected him meeting with al Qaeda operatives, to locate Headley and begin surveillance, according to U.S. officials.

“It is baffling to me that he was not interviewed sooner, especially post-Mumbai,” said Charles Swift, a lawyer for Rana who specializes in terror cases.

Headley’s lawyers had asked for a sentence of less than 30 to 35 years, asserting that their client’s “unprecedented” cooperation had “saved lives” and averted attacks around the world and that he had expressed remorse. They cited a sealed memorandum outlining Headley’s intelligence cooperation, much of which remains classified.