A federal judge has spared from a lengthy prison sentence a man who left his home in Brooklyn to join the Islamic State, crediting him for almost two years of time served and for cooperating with the United States government after he became disillusioned with the organization. The defendant in the case, who is identified as John Doe in court papers to protect his family while he works with American authorities, was convicted of two terrorism-related charges and faced a statutory maximum of 25 years in prison. But U.S. District Judge Jack Weinstein of the Eastern District of New York found that Doe, who spent four months with the terrorist group before returning to the United States, should serve a fraction of that time, citing Doe's cooperation with authorities and his current efforts to better himself, among other factors. “A lengthy prison sentence increases the risk that defendant will become embittered and regresses into radical beliefs,” the judge said in his 43-page ruling. “The prison system can be a breeding ground for radicalization.” Doe, 29, was born in Bangladesh and spent most of his life in Brooklyn. As he explained during his sentencing hearing in June, his life trajectory changed after the death of his sister and unborn child as he began embracing a more disciplined life, both socially and religiously. One resonant moment for him was viewing a provocative film called “Submission” as part of a college class that covered different views of Islam. The film featured a nude woman with verses from the Quran written on her body wearing a transparent burqa. “I just feel it was heartbreaking to see that,” Doe said at his sentencing, explaining that his sister and other relatives wore the burqa. “That's generally why it hurts.” From there, the judge said, Doe began embracing a more-right wing view of his religion and began communicating with religious radicals online. Doe's online activities eventually caught the eye of the FBI and investigators visited his house in Brooklyn to try and talk him out of joining ISIS. Alarmed by the investigators' visit and lured by expectations of an “Islamic utopia,” Doe flew from John F. Kennedy International Airport to Turkey and eventually made his way into ISIS-held territory in Syria. He worked mostly in an administrative role for the group, according to Weinstein's ruling, but was also present in at least one battle, received military training, carried firearms and was introduced to explosive belts used to kill civilians. But Doe found that the reality of being part of the group was not what he envisioned, the judge wrote—he was unprepared for the “unrestrained brutality” of ISIS and its false representations of his Muslim faith. Doe managed to escape an ISIS camp, returned to Turkey and ended up in U.S. custody. From there he began cooperating with American law enforcement, which at the time did not have a full grasp of the inner workings of ISIS, Weinstein said. Doe pleaded guilty in November 2014 to one count of material support of a terrorist group and one count of receiving military-style training from a terrorist organization. He spent 21 months in jail and was released on bail in August 2016. Finding an appropriate sentence for Doe, Weinstein said, requires balancing the defendant's good personal history, the need to address the seriousness of his crimes and protecting the public. Weinstein said it is also incumbent upon him to craft a sentence that is not “so harsh” that other former extremists will be reluctant to come forward and assist the government. According to a study by George Washington University's Program on Extremism, there are at least 12 cases of Americans returning to the U.S. after traveling to join jihadist groups in Iraq and Syria since 2011. Eight of them pleaded guilty or were convicted of criminal charges; the average sentence was roughly 10 years in prison. Assistant U.S. Attorney Seth DuCharme appeared for the government in the case and Doe was represented by Gary Villanueva. Neither the U.S. Attorney's Office for the Eastern District of New York nor Villanueva's office responded to requests for comment.