A museum in Queens has shut down an online art installation by the actor Shia LaBeouf, calling it a “serious and ongoing public safety hazard” after Mr. LaBeouf was arrested and the exhibit became a target for threats of violence.

The participatory exhibit, “He Will Not Divide Us,” was a collaboration between Mr. LaBeouf and the artists Luke Turner and Nastja Sade Ronkko. Intended as a rebuke to President Trump, the exhibit hinged on a video camera mounted on the outside of the Museum of the Moving Image in Astoria, Queens, into which passers-by were invited to repeat the phrase “he will not divide us.”

The aim was to stream online images of people repeating those words throughout Mr. Trump’s time in office.