BERLIN — A German federal court on Thursday overturned the acquittal of seven men who posed as a self-styled “Sharia police,” ordering a retrial on charges that they violated rules on wearing uniforms.

The group took to the streets of Wuppertal in September 2014, dressed in orange vests bearing the words “Sharia police” and handing out leaflets declaring the area a “Sharia-controlled zone” where alcohol, music and pornography were banned. Five of the defendants were allegedly part of the self-styled patrol and the other two alleged accessories.

Their behavior prompted an outcry in German media.

A state court found in 2016 that the vests couldn’t be classified as a uniform and weren’t intimidating, and ruled that the men couldn’t be convicted under any law.

The Federal Court of Justice sent the case back to Wuppertal, in western Germany, for a new trial by a different panel of judges. It said the lower court gave insufficient consideration to possible violations of the law, and also didn’t take into account the effect of the stunt on the people it was aimed at.

“The state court gave no consideration at all to how the action was understood by Muslims,” presiding judge Joerg-Peter Becker said in delivering the federal court’s ruling. “So the case has to be retried completely.”

The alleged initiator of the “Sharia police,” prominent German Islamic radical Sven Lau, was convicted in a separate trial last year of supporting a foreign terrorist organization — the Army of Emigrants and Partisans, known as JAMWA. He was sentenced to 5 ½ years in prison.

A court in Duesseldorf found that Lau acted as a contact for extremists wanting to fight for the group in Syria and, in 2013, helped two men from Germany join it there.