New York judge says ads are protected speech and similar campaigns have run in other cities without inciting violence.
Two gunmen have been shot dead outside a controversial exhibition featuring cartoon depictions of the Prophet Muhammad in Dallas in Texas, US authorities say.
The shooting was reported shortly before 7pm local time on Sunday outside the Curtis Culwell Center in the Dallas suburb of Garland.
The two armed suspects drove up to the front of the building in a car as the event, called the Muhammad Art Exhibit, was coming to an end, and began shooting at a security officer, the city said in a message posted online.
Garland police officers then exchanged fire with the gunmen and both suspects were shot dead, the city said.
The security guard was shot in the ankle in the gunfire, but his injuries were not considered serious and he has already been discharged from hospital.
A police bomb squad is reportedly at the scene and is inspecting the dead gunmen’s car.
A Garland police spokesman, Joe Harn, said there was a large police presence already at the scene, as police “had prepared for this event, in case something like this happened”.
Al Jazeera’s Heidi Zhou-Castro, who is near the scene of the shooting, said an area of about a kilometre radius around the incident had been locked down, following reports that a third suspect was seen near a shopping centre.
A New York-based group called the American Freedom Defense Initiative (AFDI) had claimed it was exercising their right of free expression in running the contest.
The judging was supposed to be on Sunday, with the winner from some reported 350 entries from around the country offered a $10,000 prize.
Zhou-Castro said the woman who led the AFDI group, Pamela Geller, was “known to make anti-Muslim statements”, and had gone to the courts several times to be able to place anti-Muslim advertisements around New York.
Following the shooting, Geller had tweeted from inside the cultural centre that the incident was “a war on free speech”, however her critics on Twitter said she had “been trying to provoke an incident like this for years”.
Islam forbids depictions of its prophet.
In April, AFDI won a case in the US federal court that allowed it to display a controversial advertisement referring to Muslims killing Jews on New York’s Metropolitan Transportation Authority buses.
US District Judge John Koeltl in Manhattan said the AFDI ad, which had previously run in Chicago and San Francisco, was protected speech under the First Amendment of the US constitution.
Similar AFDI campaigns have also run elsewhere, including in Washington DC.
The ad portrayed a menacing man wearing a scarf around his head and face, included a quotation “Killing Jews is Worship that draws us close to Allah” was attributed to “Hamas MTV”, and then stated: “That’s His Jihad. What’s yours?”
Geert Wilders, the Dutch far-right politician who is well-known for his anti-Islam beliefs, was one of the main speakers during the event. Wilders shared on his Twitter account that he had just left the building before the shooting.
Wilders caused a scandal last March when speaking in The Hague he asked party supporters whether they wanted “fewer or more Moroccans in the city and in the Netherlands”.
“Fewer! Fewer!” the crowd shouted as a smiling Wilders answered: “Then we’re going to take care of that.”