A New York man accused of planning a terror attack in Times Square underwent Lasik eye surgery just in case his glasses fell off during the plot and left him unable to shoot at victims.

Ashiqul Alam, 22, was charged on Friday after he was caught a day earlier in an undercover sting buying illegal guns to carry out his alleged plot.

During months of conversations with an undercover FBI agent, Alam allegedly said he wanted to attack law enforcement and civilians in Times Square.

Authorities said he had the laser eye surgery in April in preparation.

'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. Imagine what the news channel would call me the 'Looney Tunes Terrorist' or the 'Blind Terrorist',' he allegedly explained to the agent in one of their conversations.

Alam, who lives with his parents in a Queens apartment building, was arrested on Thursday just moments after paying the undercover age $400 for two Glock 19 nine millimeter semi-automatic pistols with their serial numbers stripped off.

Ashiqul Alam, 22, from Queens, was arrested on Thursday after police and the FBI learned he was inquiring about buying grenades to use in his alleged plot in Times Square

He is being held without bail after prosecutors said in federal court that he is a flight risk and a danger to the community. Alam moved to the U.S. from Bangladesh 12 years ago and is a legal permanent resident.

During months of conversations with an undercover FBI agent, Alam expressed support for the September 11 attacks in New York, as well as the militant group Islamic State, according to a court documents.

The suspect had allegedly repeatedly spoken about wanting to attack politicians in New York City and Washington D.C. between August last year up until his arrest.

Investigators say Alam decided on Times Square for the attack and went there in January to carry out surveillance of the heavily populated area.

He allegedly conducted several 'recon' trips to Times Square and used his cell phone to record the area as he searched for potential targets.

Alam considered multiple ways to conduct such an attack, including by using a suicide vest and by obtaining AR-15 assault rifles to kill law enforcement officers, the criminal complaint said.

He allegedly started conducting research about firearms online and discussed purchasing firearms with the undercover agent.

Alam told the agent in March that he was interested in buying a Glock 9mm pistol, according to the complaint. The agent then introduced Alam to an 'associate', who was also an agent, who offered to help Alam get the two illegal firearms.

The agents told Alam last month that the weapons would have to have obliterated serial numbers, and he replied 'Oh, that's good man'.

Alam then allegedly had repeated meetings and conversations with people he believed were going to sell him the weapons.

During one of those meetings, Alam was allegedly shown hand grenades because it could 'take out at least eight people'. He also asked to order ammunition as well as weapons because, he said, 'what is the point of getting a gun without ammo?', according to the complaint.

He was allegedly shown the two pistols on Thursday and handed over $400 to purchase them. Authorities say he then asked if he could buy a silencer.

Alam was arrested soon after.

Alam lived with his parents in this apartment in Jackson Heights in the city's Queens borough

With its millions of visitors each year, Times Square, often called the crossroads of the world, has been targeted by at least two bombers in recent years, despite its heavily fortified police presence

Investigators do not believe the man had links to a wider plot involving other people but took his alleged plot seriously.

They called the man's threatening statements 'aspirational' and said they never had reached a stage that endangered the public.

Alam's parents were not home on Friday afternoon and believed to be at court where their son is due to appear.

A neighbor, Shamsi Ara, told DailyMail.com that Ashiqul Alam lived at the apartment in Jackson Heights, Queens with his parents, believed to be named Mohammed and Kazi Alam.

'They are very nice people, very quiet. I don't know them well, we just say hello. They have lived here for around seven years but maybe longer. I believe they have a business in Manhattan,' Ara said.

The neighbor said that on Thursday afternoon around 15 members of law enforcement were at the apartment and left with boxes.

United States Attorney Richard Donoghue said Alam's planned attack aimed to target law enforcement officers and civilians in Times Square.

'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,' he said.

FBI Assistant Director-in-Charge William Sweeney said the case involved more than just talk and the desire to carry out a terrorist attack.

'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 said.

'Alam allegedly then took the steps to follow through on his deadly impulse, purchasing weapons to kill New Yorkers, target an elected official and attack police officers.'

Faisal Shahzad (left) pleaded guilty to attempting to plant a car bomb in Times Square in 2010. In December 2017, Akayed Ullah (right) set off a homemade pipe bomb strapped to his body in a crowded underground pedestrian tunnel near Times Square

Investigators do not believe the man had links to a wider plot involving other people but his alleged plot involved throwing grenades at people in Times Square

With its millions of visitors each year, Times Square, often called the crossroads of the world, has been targeted by multiple would-be bombers in recent years, despite its heavily fortified police presence.

Police thwarted an attempted car bomb in Times Square on West 45th Street in May 2010 by defusing a crude device made out of firecrackers and propane gas tanks.

A street vendor selling handbags noticed smoke and summoned the police.

A Pakistani-born U.S. citizen, Faisal Shahzad, pleaded guilty to the plot and was sentenced to life in federal prison.

A Pakistani-born U.S. citizen pleaded guilty to the plot, admitting that he had received bomb-making training from the Pakistani Taliban and that the group, known as Tehrik-e-Taliban Pakistan had funded the plot. He was sentenced to life in prison.

During sentencing he was unrepentant and declared himself to be part of a group of 'proud terrorists'.

He admitting that he had received bomb-making training from the Pakistani Taliban and that the group, known as Tehrik-e-Taliban Pakistan, had funded the plot.

In 2008, a military recruiting station was bombed but that particular incident still remains unsolved.

A man cycled up to the recruitment center and left a bomb next to the building. Although the glass shattered, nobody was hurt.

The FBI said in 2015 that it had identified several persons of interest in the case but so far no arrests have been made.

In December 2017, a Bangladeshi man set off a homemade pipe bomb strapped to his body in a crowded underground pedestrian tunnel near Times Square.

The man, Akayed Ullah, was convicted of six criminal counts, including use of a weapon of mass destruction and support of a terrorist organization.