Sporting detachable beards, the men drove a Humvee onto Old Town Square in Prague on Sunday, wielding fake submachine-style BB guns and waving an Islamic State flag. Accompanied by a camel and a goat, they shouted “Allahu akbar” and fired guns without pellets.

“We are bringing you the light of true faith,” the leader of the men, Martin Konvicka, who was dressed as an imam, told the crowd.

Mr. Konvicka is an anti-immigration activist, and his stunt — which had been preapproved by City Hall — was intended to sound the alarm about what he views as the threat posed by Islam to the Czech way of life. But he evidently did not anticipate how it would be received.

Prague is one of Central Europe’s most visited destinations; tourists throng the medieval Old Town and neighboring Josefov, the historic Jewish quarter, and nearby landmarks like the Charles Bridge and Prague Castle.