Court filings made clear that Ashiqul Alam had acted alone.

An immigrant from Bangladesh who allegedly expressed support for the ISIS was charged Friday with planning an attack on New York's famed tourist destination Times Square.

Ashiqul Alam, 22, sought to buy guns stripped of their serial numbers and ammunition from undercover investigators and surveilled the popular Manhattan district to identify the best place for an attack, according to the charges.

He also planned to have Lasik surgery before undertaking an attack, so that he would not have to wear glasses.

"I want to die fighting, man," Alam told an undercover US agent in January as they travelled to a Pennsylvania shooting range.

Alam, a Bangladeshi national with permanent residency in the United States, was arrested Thursday in Brooklyn as he sought to take delivery of two Glock 19 pistols he intended to use.

Court filings made clear that he had acted alone.

"There is more to this case than just talk and the desire to carry out a terrorist attack" said William Sweeney, a senior FBI official in New York.

"(Alam) took the steps to follow through on his deadly impulse, purchasing weapons to kill New Yorkers, target an elected official and attack police officers," he said.

The charges said an undercover agent first met with Alam in August 2018, but did not say what had brought the two together.

In that and subsequent meetings, Alam, who lived in Queens, expressed admiration for the ISIS and "spoke approvingly" of the September 11, 2001 Al Qaeda attacks on the United States, which Alam called a "complete success."

"Now it's up to us," he told the agent.

They discussed using a suicide vest to launch an attack in New York or Washington, but then decided to seek an assault rifle or handguns and grenades.

Twice in January the agent accompanied Alam to Times Square where Alam used his phone to record possible locations for an attack in the area.

The emblematic Manhattan plaza, at the heart of New York's theater district, has been the target of attacks in the past.

In 2017 a man named Richard Rojas rammed his car into a crowd, killing a young woman and injuring 22 other people. Rojas was a veteran of the US military and not thought to be linked to jihadist movements.

In 2016, police arrested three men allegedly planning to detonate bombs in Times Square and on the New York subway in the name of ISIS.

Alam later asked the agent to help him buy an assault rifle or other weapons for the attack, and said he wanted to shoot gay men.

In April, on a trip to a shooting range, Alam told the agent that he had an appointment for vision-correcting Lasik surgery.

"Let's say we are in an attack, right, say that my glasses fall off. What if I accidentally shoot you?" Alam told the agent.

"You know what I mean. Imagine what the news channel would call me the 'Looney Tunes Terrorist' or the 'Blind Terrorist.'"