Investigators have thwarted an ISIS-inspired mass shooting and bomb plot targeting Times Square, concert venues, and the subway system in New York City.

Prosecutors on Thursday unsealed charges against Canadian citizen Abdulrahman El Bahnasawy, 19, Philippine citizen Russell Salic, 37, and Talha Haroon, a 19-year-old US citizen residing in Pakistan.

All three were arrested months ago, but the charges had been sealed as investigators with the FBI and NYPD Counterterrorism Unit searched for possible co-conspirators.

El Bahnasawy is in US custody and has pleaded guilty to federal terror charges, while the other two men await extradition from foreign custody to face charges in the US.

Prosecutors say the three men plotted to bomb and shoot up heavily populated areas of New York City during the Islamic holy month of Ramadhan in 2016.

The FBI and NYPD Counterterrorism Unit have thwarted a mass shooting and bomb plot against Times Square and other New York sites. Pictured: NYPD forces guard Times Square

El Bahnasawy sent this image of Times Square to an undercover posing as an ISIS operator, writing: 'we seriously need a bomb at times square... Look at these crowds of people!'

El Bahnasawy took the lead on the ground, entering the US from Canada to secure a cabin near New York City to use as an operating base and bomb-making facility, according to investigators.

Meanwhile, Haroon met with explosives experts in Pakistan and planned to join El Bahnasawy in the US to carry out the attacks, and Salic sent support funds from the Philippines, according to prosecutors.

The three men communicated with each other using a messaging app, but were tricked into revealing their plan to an undercover agent on the app posing as an ISIS member.

'[W]e seriously need a car bomb at times square... Look at these crowds of people!' El Bahnasawy messaged the undercover agent along with a picture of the New York City landmark last May, according to prosecutors.

El Bahnasawy also spoke glowingly of a plan to 'shoot up concerts cuz they kill a lot of people,' the indictment said.

'[W]e just walk in with guns in our hands. That’s how the Paris guys did it,' the message said in apparent reference to the November 2015 attacks on the Bataclan theater, which left 130 dead in Paris.

Meanwhile, Haroon allegedly felt that the New York subway was a 'perfect' target, telling the undercover there would be plenty of 'women and kids' to target and adding: 'when we run out of bullets we let the vests go off.'

El Bahnasawy sent this image of the NYC subway, modified with circles and arrows. 'The 2 subways we will blow up will be the purple one, and the green one,' he wrote in one message, likely referring to the 7 train and the 4-5-6 line, which intersect at Grand Central Station

Harron also mused about an attack on Times Square in Midtown Manhattan, allegedly sending the message: 'We surround the whole street and trap them and kill as many as possible.'

'I wanna kill... them in thousands' he allegedly wrote, 'we have to make a ocean out of their blood... Leave no one standing.'

'NY Needs to fall. It’s a must,' Haroon allegedly texted the undercover federal agent.

In the Phillipines, Salic, aka 'The Doctor', allegedly played the money man, sending funds to support the plot against New York City.

Prosecutors said that Salic gloated about the benefits of operating out of the Philippines in a message to the undercover: 'Terrorists from all over the world usually come here as a breeding ground... hahahaha... But no worry here in Philippines. They dont care bout IS[IS]... loll Only in west.'

One co-conspirator allegedly texted the New York subway was a 'perfect' target, telling the undercover there would be plenty of 'women and kids' to target

Investigators monitored the plot to see how serious the men were, and sprang into action after El Bahnasawy purchased bomb-making materials and secured the cabin in the US.

On May 21, 2016, El Bahnasawy entered the US from Canada and made his way toward the New York metro area. The FBI arrested him that night in Cranford, New Jersey.

Haroon was arrested in Pakistan in September 2016 and Salic was arrested in the Philippines in April 2017.

El Bahnasawy has pleaded guilty to his role and awaits sentencing, as the two other men await extradition to the US to face charges.

All three men face sentences of life in prison.