Two teenagers from Bucks County are in custody after an explosive device was thrown near the mayor of New York City’s official residence on Saturday, NBC10 has learned.

NYPD Police Commissioner Jessica Tisch said that 18-year-old Emir Balat, who is a student in the Neshaminy School District, threw the explosive device near Gracie Mansion, causing flames and smoke to travel through the air before hitting a barrier.

“Mr. Balat lights the device and starts running with it. He then drops the device,” Tisch said.

After the first explosive device was thrown, Tisch said that Balat ran to grab a second explosive device from 19-year-old Ibrahim Kayumi, who has ties to Newtown Township. However, Balat was unable to throw the second device and both were taken into custody at the scene.

NBC10 went to an address in Langhorne in Bucks County to ask about Balat further, but the person who answered the door said he was not there and declined to comment further or share any information possible legal representation for Balat.

A bomb squad analyzed the explosive device thrown and found that it was an improvised explosive device that could have caused serious bodily harm or injury, Tisch said.

Investigators were still conducting an analysis on a second device recovered Saturday.

The NYPD and FBI are investigating the incident as as a potential act of terrorism in part because one of the two suspects in custody directly reference ISIS in statements to law enforcement, multiple people familiar with the matter said.

Whether it was Balat or Kayumi who directly referenced ISIS has not been announced.

An FBI spokesperson told NBC10 that they are conducting interviews with people who knew the two suspects in Pennsylvania as well on Sunday.

Police have said that Balat and Kayumi were in the area with a large number of counterprotesters to conservative influencer Jake Lang’s protest, called “Stop the Islamic Takeover of New York City, Stop New York City Public Muslim Prayer.”

Overall, six people were arrested as a result of Saturday’s protest — the two men “responsible for handling and deploying the devices,” the person who deployed pepper spray and three others related to disorderly conduct and obstructing traffic, Tisch said.

New York City Mayo Zohran Mamdani and first lady Rama Duwaji, who are Muslim, were home at the time of the commotion.

Both Balat and Kayumi remain in custody as of Sunday afternoon.