Commuters exit the Wall Street subway station last month in New York. (Michael Nagle/Bloomberg News)

Federal authorities revealed Friday they had arrested and charged three men in connection with a 2016 plot to carry out bombings and shootings in crowded areas of New York City, then kept the court case under seal for more than a year as investigators worked.

The alleged scheme was more nefarious than many: The group, which wanted to attack Times Square and the New York City subway system, claimed to have been in touch with an Islamic State affiliate to obtain the official sanction of the terrorist group, prosecutors said.

One of them, a U.S. citizen living in Pakistan, traveled in that country to meet with explosives experts and another purchased bombmaking materials and secured a cabin within driving distance of New York City, the prosecutors said.

By that time, though, the group was unknowingly communicating with an undercover FBI agent, who was posing as an Islamic State supporter, authorities said.

Authorities arrested one in the group in May 2016 after he traveled to the United States, allegedly to prepare for the attacks, and took the others into custody in Pakistan and the Philippines in September 2016 and April 2017.

Charged in the case were Abdulrahman El Bahnasawy, a 19-year-old Canadian citizen; Talha Haroon, a 19-year-old U.S. citizen living in Pakistan; and Russell Salic, a 37-year-old Philippine citizen, authorities said.

Bahnasawy was arrested in New Jersey in May and has pleaded guilty to terrorism offenses. The other two were arrested in the countries in which they live and prosecutors are hoping to extradite them to the United States, authorities said.

Prosecutors announced the case against the men as investigators continue to explore what sparked a 64-year-old retired accountant to open fire on a crowd at an outdoor concert on the Las Vegas Strip, killing 58 and injuring hundreds more in the worst mass shooting in modern American history. The Islamic State has claimed that attack, though authorities have said repeatedly they have found no evidence to support the terrorist group's assertion.

Prosecutors alleged the men in New York plotted similar mass destruction during the Islamic holy month of Ramadan. The men wanted to carry out bombings and shootings in Times Square and the New York City subway system and shoot people at concert venues, and they referenced similar attacks in Brussels and Paris, authorities said.

Bahnasawy told the undercover FBI agent he wanted to “create the next 9/11” and in May 2016 sent maps of the New York City subway system with plans for where explosives could be detonated, prosecutors alleged. He also asserted the group should put a car bomb in Times Square, prosecutors alleged.

“Look at these crowds of people!” he wrote, according to prosecutors.

Meanwhile, in Pakistan, Haroon allegedly told the undercover FBI agent that he planned to travel to the United States to join in the attacks and “cause great destruction” and that he had been in touch with a branch of the Islamic State active in Pakistan.

“NY Needs to fall,” Haroon wrote to the undercover agent. “It’s a must.”

Bahnasawy bought 40 pounds of hydrogen peroxide, which prosecutors alleged could be used to make a component of an improvised explosive device, as well as batteries, Christmas lights, thermometers and aluminum foil, prosecutors said.

They said Salic, who had a pro-Islamic State social media presence, told the undercover agent he was prepared to transfer money to help fund the attacks and claimed to have previously sent money to other countries to support the Islamic State. He ultimately sent $423 to the undercover agent, authorities said.

When Bahnasawy traveled from Canada to the New York City area on May 21, 2016, to begin preparing to execute the plan, Canadian and U.S. law enforcement were watching and took him into custody, authorities said. The case was initially sealed because prosecutors feared revealing it could compromise an ongoing investigation into an imminent terrorism threat.

All three men are charged with conspiring to use weapons of mass destruction, conspiring to commit terrorism and other related offenses, authorities said.