A Bangladeshi man who tried to blow up the Federal Reserve Bank of New York remotely only to find that the bomb was fake and his plot had been under the constant surveillance of federal agents pleaded guilty on Thursday to terrorism charges.

The plea of the man, Quazi Mohammad Rezwanul Ahsan Nafis, 21, brought a quick resolution to a case that used one of the government’s most popular strategies for identifying and pursuing terrorism suspects: Undercover agents and a confidential source who learned that Mr. Nafis wanted to conduct an attack gave him the materials for a fake bomb and other support, leading him all the way to the moment of detonation before arresting him in October.

In response to criticism of the law enforcement approach — and the claim that men like Mr. Nafis could not pull off an attack without the government’s help — Loretta E. Lynch, the United States attorney for the Eastern District of New York, emphasized that Mr. Nafis had entered the United States with plans to carry out the attack and that the sting operation was the best way to stop him.

“He came with information about how to make bombs,” Ms. Lynch said in a news conference outside the Federal District Court in Brooklyn. “At every opportunity this defendant showed his determination and commitment to this plan.”