(CNN) - A man who investigators allege was plotting to kill people in New York's Times Square is being held on weapons charges, accused of buying two illegal pistols from an undercover government agent, federal prosecutors said Friday.
Ashiqul Alam, 22, of Queens, was charged in a federal court in Brooklyn with knowingly receiving two firearms with obliterated serial numbers, a criminal complaint reads. He is being held without bail.
Alam briefly appeared in Brooklyn federak court Friday for his arraignment, wearing a purple T-shirt, jeans and red and black sneakers. His attorney proposed a bail package that included a $200,000 secured bond to be signed by Alam's parents, who were also in the courtroom. A federal prosecutor argued that there was no condition that would be appropriate, saying "the nature and circumstances of this offense are extremely serious."
A magistrate judge denied bail, noting that Alam poses a danger to the community and is a flight risk.
Alam, a Bangladeshi citizen and lawful permanent US resident, was taken into custody Thursday after giving an undercover agent a total of $800 for two pistols that had the manufacturers' serial number scratched off, the complaint alleges.
Authorities allege Alam, in meetings with an undercover agent beginning in August, repeatedly expressed a desire to buy weapons, explosives and a suicide vest for terror attacks at either a large event at Times Square or in Washington in order to kill what the complaint describes only as a senior government official.
The complaint alleges Alam focused on Times Square as time went on, and undercover investigators eventually set up Thursday's gun purchase in Brooklyn, the complaint reads.
"As alleged, Ashiqul Alam bought illegal weapons as part of his plan to kill law enforcement officers and civilians in a terrorist attack on Times Square," Richard Donoghue, US attorney for New York's Eastern District, said in a news release.
"What he did not know was that he was buying weapons from government agents, who were monitoring his plans and intervening to prevent those plans from escalating into deadly violence," Donoghue said.
Alam also had expressed interest in purchasing explosives with the intention of detonating them in Times Square, a law enforcement source told CNN on condition of anonymity.
The Federal Bureau of Investigation's Joint Terrorism Task Force along with the New York Police Department handled the operation to investigate and arrest the man, the law enforcement source told CNN.
William F. Sweeney Jr., assistant director in charge of the FBI's New York field office, said in Friday's news release that Alam is accused of "purchasing weapons to kill New Yorkers, target an elected official and attack police officers."
Sweeney did not name the elected official or say whether the official is separate from the one mentioned in the complaint.
"There is more to this case than just talk and the desire to carry out a terrorist attack," Sweeney said. "Individuals who believe in the distorted and deadly propaganda of terrorist organizations and work toward acting on those deadly impulses are incredibly dangerous and unpredictable."
He met with an undercover agent for months
Alam met with an undercover agent for several months. He spoke approvingly about various terrorist attacks -- including the September 11 attacks -- and terror groups such as ISIS, surveyed Times Square while "looking for potential targets," and discussed the purchase of firearms, according to the complaint.
Details about how Alam initially met the undercover agents weren't immediately available. He had been under surveillance for some time, a law enforcement source told CNN on Friday.
In a meeting with an agent last September 11, Alam praised Osama bin Laden and said bin Laden's "mission is a complete success, thousands of American soldiers died and trillions of their monies gone in the war," according to the complaint.
In January, Alam traveled with the agent to shooting range in Pennsylvania, where they took a lesson. During the drive, the complaint said, Alam discussed ISIS and said," I want to die fighting man."
Months later, they returned to the shooting range and the agent asked Alam whether he would use a firearm during the attack. He told the agent he "would potentially use a firearm after first using a bomb," the complaint said.
They began discussing the purchase of two pistols in March and Alam asked the agent to help him contact someone who could sell them to him. Alam was arrested after he bought the firearms from another undercover agent Thursday, officials said.
Alam is scheduled to appear again in a Brooklyn federal courtroom June 21.
Times Square, the commercial and entertainment hub around Broadway and 7th Avenue in Midtown Manhattan, draws about 380,000 pedestrians a day, according to the Times Square District Management Association, making it one of the most visited locations in the world.
The area has been the subject of terror plots before. In 2010, Pakistani-American Faisal Shahzad tried, and failed, to set off a bomb in a vehicle in Times Square, authorities said. He was arrested after street vendors tipped off police to the abandoned car.
He pleaded guilty that year to charges including attempting to use a weapon of mass destruction and was sentenced to life in prison.
CNN's Nicole Chavez, Madeline Holcombe, Joe Sutton contributed to this report.
The-CNN-Wire ™ & © 2019 Cable News Network, Inc., a Time Warner Company. All rights reserved.