A federal judge ordered on Tuesday that a Brooklyn man be sent to jail for refusing to testify before a grand jury believed to be looking into a homemade bomb that exploded in front of an armed forces recruitment center in Times Square in 2008.

The man, Gerald Koch, 24, is not a target of the investigation, and has been offered immunity from prosecution. Mr. Koch, who has described himself as an anarchist, has said that he knows nothing about the attack, and fears that prosecutors may seek to learn about his political affiliations through the grand jury.

One of Mr. Koch’s lawyers, Susan V. Tipograph, said that he refused to testify in 2009 and was not jailed. But last week, after he again refused, he was directed to appear on Tuesday before Judge John F. Keenan of Federal District Court in Manhattan.