In addition, the complaint said, Mr. Nafis spoke of a desire to “attack and kill” a high-ranking government official. A senior law enforcement official said Wednesday night that the official was President Obama, but that Mr. Nafis’s desire never got past the talking stage.

Image Quazi Mohammad Rezwanul Ahsan Nafis

Mr. Nafis was charged with conspiring to use weapons of mass destruction and providing material support to Al Qaeda. He could face up to life in prison if convicted.

Mr. Nafis arrived at Federal District Court in Brooklyn, looking boyish despite his trim beard. He spoke quietly when answering the questions of the magistrate judge, Roanne L. Mann.

The case appears to be the latest to fit a model in which, in the process of flushing out people they believe present a risk of terrorism, federal law enforcement officials have played the role of enabler. Agents and informers have provided suspects with encouragement, guidance, money and even, the subjects of the sting operations are led to believe, the materials needed to carry out an attack. Though these operations have almost always held up in court, they have come under increasing criticism from those who believe that many of the subjects, even some who openly espoused violence, would have been unable to execute such plots without substantial assistance from the government.

Both F.B.I. leaders and federal prosecutors have defended the approach as valuable in finding and stopping people predisposed to commit terrorism.