New York officials and the FBI have launched an investigation into "an act of ISIS-inspired terrorism", following the attempted use of two homemade explosives near the official residence of New York City Mayor Zohran Mamdani on Saturday.

The devices - which were both ignited, and at least one of which was thrown - "could have caused serious injury or death", New York City Police Commissioner Jessica Tisch said.

The incident occurred after a group of anti-Islam protesters gathered outside Mamdani's mayoral residence, Gracie Mansion, and clashed with a larger group of counter-protesters.

Two men who appeared agitated by the anti-Islam protesters have been arrested in connection with the devices.

The suspects were identified as 18-year-old Emir Balat and 19-year-old Ibrahim Kayumi, both from Pennsylvania.