Judge Raymond Dearie told Zazi that the "government has no reservation" as to his mindset, but said, "You'll understand my healthy skepticism."
Before pronouncing the sentence, Dearie said Zazi was being given an "unthinkable" second chance and that he had earned it.
"If you wish to appeal this ruling, you should have your head examined," the judge said.
Zazi pleaded guilty in 2010 to an Al Qaeda-inspired plot to attack the subway. Federal sentencing guidelines indicated he should serve life in prison, but his sentencing was delayed again and again as he cooperated with authorities.
Let our news meet your inbox. The news and stories that matters, delivered weekday mornings.
According to a sentencing memo from prosecutors filed this February, he provided "extraordinary" assistance, including evidence that led to the conviction of his two closest friends and testified at trials in the United States. Prosecutors said he had met with the government more than 100 times while in federal custody, and had "directly contributed to the prosecution of numerous individuals."
Many pages of the memo that detail his cooperation are redacted.
"Once Zazi decided to cooperate in February 2010, he gave the government his full, complete cooperation," the memo said.
The memo does not make a recommendation to the judge for a specific sentence, "under the terms of the cooperation agreement in this matter."
Zazi was born in Afghanistan and raised in Pakistan until he was a teenager. In 1999, he and his family moved to the borough of Queens in New York City.
That August, he and two co-conspirators traveled to Pakistan and were recruited by Al Qaeda. He was trained at a camp in the Waziristan region of Pakistan in how to make explosive devices, and agreed to carry out a suicide bombing attack. Among the targets suggested by Al Qaeda leaders was the New York City subway system.
Zazi came back to the U.S. in early 2009 and began living with relatives in the Denver area, where he drove an airport shuttle.
FBI agents began eavesdropping on Zazi's phone conversation. By the summer of 2009, he was buying the needed ingredients for TATP, an explosive used in several high-profile jihadi attacks in the West.
On Sept. 9, 2009, Zazi began driving from Colorado to Queens. He was tailed by FBI agents. After being stopped and searched by police at the George Washington Bridge, he arrived in New York City on the afternoon of Sept. 10 with plans to finish building his bombs.
Zazi and his two co-conspirators, Adis Medunjanin and Zarein Ahmedzay, rode the subway and developed plans to blow up backpack bombs near the busy Grand Central and Times Square stations in Manhattan. On Sept. 11, his rental car was towed for a parking violation, and was searched. A laptop in the car held notes on making bombs in his handwriting.
Wary of discovery, Zazi threw away his bombmaking materials and flew back to Denver. He was arrested in Colorado on Sept. 19, and ultimately charged in the Eastern District of New York with conspiracy to use weapons of mass destruction.
Zazi's two co-conspirators are both in federal prison. Ahmedzay pleaded guilty to terrorism charges and received a sentence of 10 years. Medunjanin was found guilty on terrorism charges and sentenced to life imprisonment.
Zazi's father received a four and a half year sentence for destroying evidence and lying to investigators. Imam Ahmad Afzali was charged with tipping Zazi off to government surveillance but negotiated a plea deal in which he left the U.S. permanently instead of serving jail time.
In February 2010, Zazi pleaded guilty to three counts — material support for terrorism, conspiracy to use weapons of mass destruction, and conspiracy to commit murder in a foreign country — and agreed to cooperate with authorities. The offenses carried a possible sentence of life without parole, but his ongoing cooperation, which began even before his guilty plea, meant sentencing was delayed repeatedly starting in 2011.
Jonathan Dienst is a reporter for WNBC-TV in New York, leading its investigative reporting team and covering justice and law enforcement issues.