Tom Gianni / AP David Coleman Headley is shown in a courtroom sketch from May 2011.

CHICAGO - David Headley, an American who admitted scouting targets for the 2008 Islamic militant raid on Mumbai and later agreed to testify against the plotters to avoid the death penalty, was sentenced on Thursday to 35 years in prison.

The sentence, handed down by U.S. District Judge Harry Leinenweber, was the maximum sought by federal prosecutors.

The attacks killed more than 160 people, including six Americans. Headley, a 52-year-old U.S. citizen of Pakistani descent, admitted videotaping sites that were targeted by the Mumbai attackers.

He was arrested in 2009 and pleaded guilty to 12 charges, including conspiracy to bomb places of public use and commit murder and plotting an attack on a Danish newspaper.

After entering his plea in 2010, Headley cooperated with U.S. investigators and foreign intelligence agencies to avoid the death penalty and extradition to India, Pakistan or Denmark, agreeing to testify in foreign judicial proceedings, the government said.

In a memorandum filed with Judge Leinenweber earlier this week, the government said "there is little question that life imprisonment would be an appropriate punishment for Headley's incredibly serious crimes but for the significant value provided by his immediate and extensive cooperation."

Last week, Judge Leinenweber sentenced Pakistani-born businessman Tahawwur Rana to 14 years in federal prison for providing support to the Lashkar-e-Taiba, the group blamed for the Mumbai attacks.