(TNND) — A New York man is facing federal charges after building and stashing homemade bombs in New York City, including on the subway and rooftops.

Michael Gann was charged after manufacturing at least seven of these explosive devices. The U.S. Attorney for the Southern District of New York, Jay Clayton, said he used chemicals he ordered online to make them.

“The safety of New Yorkers is paramount,” said U.S. Attorney Jay Clayton. “As alleged, Michael Gann built explosive devices, stored them on a rooftop in SoHo, and threw one onto the subway tracks—putting countless lives at risk. Thanks to swift work by our law enforcement partners, no one was harmed. That vigilance assuredly prevented a tragedy in New York.”

Gann threw one of these devices onto active subway tracks at the Williamsburg Bridge, said NYPD Commissioner Jessica Tisch.

He also stored the devices, as well as shotgun shells, on the roofs of residential apartment buildings in Manhattan. After, Gann lied to law enforcement and said he stored the devices in a dumpster.

“This defendant allegedly stockpiled homemade explosives and traveled to New York City with these deadly devices,” Tisch said.

The chemicals he used are known as “precursor chemicals,” which included two pounds of potassium perchlorate and approximately one pound of aluminum powder. With that, he ordered over 200 cardboard tubes and over 50 feet worth of fuses.

Gann also conducted searches online related to firearms and explosives, according to the attorney’s office. He even posted to Instagram, “Who wants me to go out to play like no tomorrow?”

If convicted, Gann faces up to 40 years in prison.