A pro-Israel group known for publicly criticizing Islam will be allowed to display an advertisement containing the phrase “Hamas Killing Jews” on New York City’s buses, a judge ruled Tuesday.

Judge John Koeltl said the ad is protected speech, but added that he was sensitive to the Metropolitan Transportation Authority’s claim that the ad could incite violence and appreciates the efforts necessary to prevent violent attacks.

However, Koeltl noted that the same ads ran in San Francisco and Chicago in 2013 without incident. He also said that examples of violent attacks cited by the MTA show that individuals might commit heinous acts without warning.

"Under the First Amendment, the fear of such spontaneous attacks, without more, cannot override individuals' rights to freedom of expression," Koeltl said in a ruling dated Monday. He stayed the effect of the decision for a month so it can be appealed.

MTA spokesman Adam Lisbery said the agency is disappointing in the ruling and is reviewing its options.

It came in a lawsuit filed last year by the American Freedom Defense Initiative, an organization headed by blogger Pamela Geller that's behind the advertisement.

David Yerushalmi, a lawyer for the organization, said the decision "sends a strong message both to government bureaucrats who would restrict our freedom of speech based upon what they perceive to be a global jihadist threat, and it also sends a telling message to our enemies abroad and at home: Their threats of violence will not prevent the courts from upholding the First Amendment."

The lawsuit was filed after the MTA notified the group in August that it would display three of four proposed ads but not an ad with the quote “Killing Jews is Worship that draws us close to Allah” because it could incite violence. The ad shows a covered face next to the quote attributed to “Hamas MTV.” It is followed by the words: “That’s his jihad. What’s yours?”

The MTA said in a statement in September it recognized that the rejected ad was a parody of "MyJihad" ads sponsored by the Council on American-Islamic Relations, which said it was promoting the concept that jihad is an individual and person struggle rather than a violent conflict or terrorism.

Koeltl said he recognized that the MTA believes it would be far more difficult to counter the advertisement because it has parodic aspects.

But he said he believes the agency underestimates "the power of counter-advertisements to explain that the MTA does not endorse the ad and that the ad is not to be taken seriously."

Monica Klein, a spokeswoman for Mayor Bill de Blasio, noted in a statement that the mayor has said "these anti-Islamic ads are outrageous, inflammatory and wrong, and have no place in New York City, or anywhere."

"These hateful messages serve only to divide and stigmatize when we should be coming together as one city," she added. "While those behind these ads only display their irresponsible intolerance, the rest of us who may be forced to view them can take comfort in the knowledge that we share a better, loftier and nobler view of humanity."

The Associated Press contributed to this report.