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.

NBC10 was also outside a home in Newtown on Sunday night when someone was taken away in handcuffs and the FBI went inside to search the home in connection to the incident.

“I can confirm the FBI is conducting court authorized law enforcement activity,” a spokesperson told NBC10. “I would have nothing additional to provide.”

It was not immediately clear who was taken into custody.

The FBI was also carrying out a search warrant in Middletown Township in Bucks County in the area of Durham Road and Frosty Hollow Road on Sunday night, police there said.

Middletown Township police said on Facebook that there was no known threat to the public.

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 — Balat and Kayumi, a person who deployed pepper spray and three others related to disorderly conduct and obstructing traffic, Tisch said.

Ian McGinnis, of Philadelphia, was among the other four arrested not in connection to the explosives, according to court records. He faces charges including assault, unlawful reckless endangerment and unlawful possession of noxious matter.

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

“Violence at a protest is never acceptable,” Mamdani said in a statement. “The attempt to use an explosive device and hurt others is not only criminal, it is reprehensible and the antithesis of who we are.”

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