A man who plotted to bomb New York City's subways, then switched sides after his arrest and spent nearly a decade helping the U.S. identify and prosecute terrorists, was rewarded for his help Thursday with a sentence of 10 years in prison, effectively time he has already served.

Najibullah Zazi, a 33-year-old naturalized U.S. citizen who became radicalized and received explosives training from al-Qaida after traveling to Pakistan in 2008, faced up to life in prison after pleading guilty to terrorism-related charges.

The subway plot sent shockwaves through New York and the federal law enforcement community, underscoring the continuing threat of terrorism years after 9/11. But federal prosecutors said Zazi provided “extraordinary” assistance to U.S. counterterrorism authorities after his 2009 arrest, implicating his closest friends and offering a window into the inner workings of al-Qaida.