The man who plotted to bomb New York City's subway system and then switched sides to help investigators may be released from prison in the next few days.

Najibullah Zazi, a would-be terrorist trained by al Qaeda bomb-makers, pleaded guilty in 2010 to three charges associated with a plan to detonate explosive in the NYC subway. He was, according to CNN, charged with conspiring to use weapons of mass destruction, conspiracy to commit murder in a foreign country and providing material support to a terrorist organization.

For his crimes, he was facing life in prison.

Over the past decade, though, Zazi has spent his time helping federal investigators. He has “provided critical intelligence and unique insight regarding al Qaeda and its members,” court filings reportedly revealed. Prosecutors wrote that Zazi's “extraordinary assistance” has “directly contributed to the prosecution of numerous individuals.”

On Thursday, Judge Raymond Dearie made the surprising decision to sentence him to only 10 years in prison, the majority of which has already been served. The judge called it an “unthinkable” second chance, adding, “If you wish to appeal this ruling, you should have your head examined.”

Prior to the judge's ruling, Zazi told the court, “I am sorry for the harm that I caused. I am asking for forgiveness. I tried my best to correct a horrible mistake. I am not the same person,” NBC reported.

Najibullah Zazi (Associated Press/Ed Andrieski)

Zazi was born in Afghanistan and raised in Pakistan until he moved to Queens in New York City with his family as a teenager. In 2008, he returned to Pakistan, where he was recruited by al Qaeda operatives and trained to make explosives.

Zazi came back to the U.S. in 2009 and began making preparations for a suicide bombing attack on the New York City subway system, but his plans were uncovered and he was arrested just a few days after the 9th anniversary of the September 11 terrorist attacks.

After he was arrested in 2009, Zazi told reporters he had done no wrong, according to the New York Times.

Reflecting on his past actions in court, he said, “I find it almost hard to imagine what I was involved in in 2008 and 2009.”

The judge reportedly repeatedly expressed skepticism of claims Zazi had denounced radical Islam and turned away from his past life before sentencing Zazi, but ultimately opted for leniency rather than sentencing the man to life in prison without parole.

Read more from Business Insider:

SEE ALSO: 17 Years After 9/11, Al Qaeda May Be Stronger Than Ever

WATCH NEXT: Al Qaeda Has A Women's Magazine?