ABC News June 7, 2019

Man arrested after saying he wanted to throw grenades in Times Square, sources say

WATCH: Man arrested after saying he wanted to throw grenades in Times Square, sources say

A 22-year-old man is in federal custody after he asked about buying grenades and discussed possibly detonating them in New York City's Times Square, according to law enforcement sources.

The man, identified as Ashiqul Alam, was intercepted by federal and local officials, and he posed no imminent threat.

He was arrested on charges of attempting to buy a gun with a defaced serial number, the sources told ABC News. He is expected to appear in federal court in Brooklyn on Friday afternoon.

(MORE: NJ man arrested for allegedly supporting Hamas)

Alam, who lives in the Jackson Heights neighborhood of Queens, was detected both inquiring about obtaining grenades and discussing using them in Times Square, the sources told ABC News.

Members of the New York Joint Terrorism Task Force -- made up of FBI agents and New York Police Department detectives -- began tracking Alam and eventually took him into custody.

He is not believed to be linked to any other people or part of a larger plot.

Gary Hershorn/Corbis via Getty Images
A new advertising board is installed on One Times Square on May 9, 2019 in New York City.

The U.S. Attorney’s Office is expected to comment later Friday.

The NYPD referred all questions to the FBI.

Alam is represented by Federal Defenders, who offered a bail package of $200,000 and to have their client wear an ankle monitoring device and home confinement.

But a federal court judge, Magistrate Cheryl Pollak, ordered Alam to be "permanently detained," labeling him a "danger" to the community based on his statements in the complaint and his desire to purchase firearms with the serial numbers scratched out.

He is scheduled to appear in court on June 21.

(MORE: Authorities arrest man accused of plotting 'mass casualty' terrorist attack in California)

Times Square has been the site of a few attempted attacks in recent years. In May 2017, a man crashed his car into a group of people, killing one and injuring 20 others. The suspect, Richard Rojas, was later determined to be on drugs and suffering from mental illness.

The most noteworthy example of a foiled terror attack in Times Square came in 2010 when two good Samaritans noticed a smoking car and alerted authorities, who foiled the car bomb attempt.

ABC News Christina Carrega contributed to this report.