A New York City college student accused of plotting a terrorist attack on Times Square spent months trying to stockpile guns and grenades, heaped praise on the Islamic State group and Osama bin Laden, and feared being known as the "Looney Tunes Terrorist" if his glasses fell off and he couldn't shoot straight, federal prosecutors said Friday.

Ashiqul Alam was arrested Thursday after arranging through an undercover agent to buy a pair of semiautomatic pistols with obliterated serial numbers, prosecutors said. Police Commissioner James O'Neill said that development was "a clear indicator of (Alam's) intent to move his plot forward."

Despite the grave allegations, the 22-year-old Alam is charged only with offenses related to the gun transaction. Alam, wearing blue jeans and a purple T-shirt, did not enter a plea at an initial appearance Friday in federal court in Brooklyn.

Defense attorney James Darrow argued that his client should be released on a $200,000 bond since his client has a solid background and the charges he's facing so far don't include terrorism.

The defendant, a legal resident born in Bangladesh, moved to the U.S. as a child about 12 years ago, Darrow said. He has lived in Queens with his parents while attending John Jay College of Criminal Justice and working two jobs, the lawyer added.

But a federal magistrate ordered Alam held without bail after prosecutors argued that he was a danger to the community and a flight risk. Family members who attended the hearing left court without speaking to reporters.

Court documents describe months of plotting for an attack Alam told an undercover agent would make them "legends."

Alam spoke of plotting to kill civilians and law enforcement officers in Times Square and targeting a senior government official in Washington, according to the documents.

He talked about wanting to "shoot down" gays, referring to them with a slur; using a "rocket launcher, like a huge one," to cause havoc at the World Trade Center; and obtaining an enhanced driver's license so he could walk onto a military base and "blow it up," the documents said.

Alam started speaking with the undercover agent about his plans in August and went with him on reconnaissance trips to Times Square and to a shooting range in Pennsylvania, the documents said.

Alam "repeatedly expressed interest in purchasing firearms and explosives for a terrorist attack in the New York City area" during conversations with the agent and spoke glowingly about past attacks on the city, the court documents said.

Alam used his cellphone to take video of Times Square and "explained to the undercover that he was looking for potential targets," according to the documents.

Alam also allegedly discussed buying a silencer, ammunition and hand grenades, which he said could each "take out at least eight people."

In April, Alam told the undercover agent he was planning to get laser eye surgery so he wouldn't have to wear glasses during the planned attack, the documents said.

"Let's say we are in an attack, right, say that my glasses fall off. What if I accidentally shoot you? You know what I mean?" Alam said in a recorded conversation, according to the documents. "Imagine what the news channel would call me, the Looney Tunes Terrorist or the Blind Terrorist."

Times Square, the heart of the Broadway theater district and packed with tourists day and night, has been a target of attacks before.

In 2010, Faisal Shahzad, a U.S. citizen who had gotten explosives training in Pakistan, tried but failed to detonate a car bomb there. He was sentenced to life in prison.

In 2017, a Bangladeshi immigrant, Akayed Ullah, detonated a bomb in an underground pedestrian concourse linking the Times Square subway station to the Port Authority Bus Terminal. Only Ullah was seriously hurt, though bystanders were injured by shrapnel.

That same year, a man who told police he was high on drugs and hearing voices drove his car into the square's crowds, killing a teenager and injuring around 20 people.

Police always have a heavy presence in Times Square, and its sidewalks and plazas are partially protected with steel posts intended to stop vehicles.