Like countless 19-year-olds, Akhror Saidakhmetov lived much of his life online.

But it was some of the darkest corners of the Internet that compelled him, according to the authorities. On websites sympathetic to the Islamic State, he could find videos of the organization’s beheadings, mass executions and crucifixions, carried out in a campaign to seize territory in Iraq and Syria and establish a fundamentalist Islamist caliphate.

In recent months, the authorities say, Mr. Saidakhmetov had made up his mind to go to Syria and join the fight.

But before he could go off to wage war, he needed to get his passport back from his mother.

He worried about this, confiding in his friend Abdurasul Hasanovich Juraboev.

Week after week, Mr. Juraboev, 24, had worked alone in a dank basement beneath the Gyro King on Foster Avenue in Brooklyn, chopping vegetables for 10 hours a day, six days a week.