Mayor Zohran Mamdani was inside Gracie Mansion, his official residence on the Upper East Side of Manhattan, when two people were arrested after attempting to set off a pair of “suspicious devices” as two protest groups clashed outside.

Mamdani and first lady Rama Duwaji were unharmed in Saturday’s commotion, which started as an anti-Islam demonstration led by conservative influencer Jake Lang. A counterprotest was also on site.

“Thankfully, the Mayor and the First Lady are both safe, though the events are a stark reminder of the threats they both face regularly,” a spokesperson for the mayor said.

The devices were smaller than a football, NYPD Commissioner Jessica Tisch said, and appeared to be jars wrapped in black tape with nuts, bolts, screws and a hobby fuse. She did not yet know if the devices were functional and said the bomb squad was investigating.

View of an unexploded homemade device in front of Mayor Zohran Mamdani's official residence in New York on Saturday.

CHARLY TRIBALLEAU / AFP via Getty ImagesCHARLY TRIBALLEAU / AFP via Getty Images

View of an unexploded homemade device in front of Mayor Zohran Mamdani’s official residence in New York on Saturday.

Two young men from Pennsylvania, ages 18 and 19, were arrested in connection to the devices, sources familiar with the investigation told NBC New York. Law enforcement have left the state to speak to their relatives.

The FBI’s joint terrorism task force has joined the investigation, sources familiar with the probe told NBC New York.

Police said the men were counterprotesters to 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.

Police said six people were placed into custody after a pair of “suspicious devices” were ignited Saturday during protests outside of Gracie Mansion, the official residence of the mayor of New York City. NBC New York’s Adam Harding reports.