Police stopped an international terror plot to cause bloodshed at New York City concert venues, subway stations and Times Square, officers said.
One of the defendants, Abdulrahman El Bahnasawy, was arrested after travelling from Canada to New Jersey in May 2016 to stage the attacks, according to police.
The capture of the Canadian citizen came after an investigation using an undercover FBI officer posing as an Islamic extremist that also led to the arrests last year of US citizen Talha Haroon in Pakistan and Russell Salic in the Philippines, where he is a citizen.
According to court papers, El Bahnasawy, 19, sent the undercover officer an image of Times Square with a smartphone message saying, "We seriously need to car bomb times square. Look at these crowds of people!"
In another, he expressed a desire to "shoot up concerts cuz they kill a lot people. ... We just walk in with guns in our hands. That's how Paris guys did it," the papers said, in an apparent reference to the slaughter by men armed with weapons at the Bataclan concert hall in Paris in 2015.
The undercover officer and El Bahnasawy also were in communication with the 19-year-old Haroon, who wanted to join El Bahnasawy in New York City for the attacks, authorities said.
Haroon, who at one point met with an explosives expert in Pakistan for information on building bombs, told the undercover officer the subway was a "perfect" place to shoot passengers, and that "when we run out of bullets we let the vests go off," court papers said.
After Haroon talked about what was needed to build explosives, El Bahnasawy bought 40 pounds of hydrogen peroxide, batteries, Christmas lights, thermometers and other ingredients commonly used in homemade bombs.
He later shipped the material to the undercover officer in the United States, where he and Haroon planned to use a cabin in a rural area within driving distance of the city to build bombs and take target practice, authorities said.
Salic, 37, was accused of sending money to help fund the attacks, court papers said.
He told the undercover officer his ultimate goal was to join the Islamic State group in Syria but that "it would be a great pleasure if we can slaughter" people in New York, the papers said.
El Bahnasawy pleaded guilty in October 2016, but the case remained unreported while the investigation continued.
His lawyer, Sabrina Shroff, declined to comment on Friday, while Haroon and Salic were awaiting extradition.
All three men face possible life sentences on charges including conspiracy to use weapons of mass destruction and conspiracy to provide material support to terrorists.
The Royal Canadian Mounted Police said it assisted the FBI in the investigation.
"At no time was the safety or security of the public at risk," it said.