A court in Germany has rejected a case calling for a local church associated with the Protestant firebrand Martin Luther to remove an ancient antisemitic carving from its wall.

Known as the Judensau (Jews’ sow), the 13th-century bas-relief on the church in Wittenberg, Saxony-Anhalt state, depicts a rabbi peering into a pig’s anus, while other figures suckle from its teats.

The hateful symbolism is that Jews obtain their sustenance and scripture from an unclean animal.

A panel of judges at the state’s superior court in Naumburg found the image “did not harm Jews’ reputation” because it was “embedded” in a wider memorial context, the presiding judge, Volker Buchloh, said, according to regional broadcaster MDR.

After failing at a lower court with his claim that the sculpture was insulting to Jews and should be removed, a local Jewish man had appealed against the decision.

Announcing Tuesday’s ruling, Buchloh said “anyone looking at the relief cannot fail to see the memorial and the information sign the parish put up in 1988” placing it in the proper context.

Johannes Block, the pastor of Wittenberg Stadtkirche, told the Munich-based daily Sueddeutsche Zeitung on Monday that the image was a “repulsive and tasteless” attack on Jews that “fills me with shame and pain”.

“We did not ask for this sculpture, but are trying to handle this difficult inheritance responsibly,” he added, saying he was in talks with the Central Council of Jews in Germany on how to update the memorial.

Many churches in the Middle Ages had similar Judensau carvings, which were also aimed at sending the stark message that Jews were not welcome in their communities.

Another example can be seen at Cologne Cathedral.

But the importance of the Wittenberg relief is tied to Luther, himself a notorious antisemite, who preached there two centuries later.

It was in Wittenberg that Luther is said to have nailed his 95 theses to another church’s door in 1517, leading to a split with the Roman Catholic church and the birth of Protestantism.

The theologian argued that Christians could not buy or earn their way into heaven but could only enter by the grace of God, marking a turning point in Christian thinking.

But Luther also came to be linked to Germany’s darkest history, as his later sermons and writings were marked by antisemitism – something the Nazis would later use to justify their brutal persecution of the Jews.

The superior court’s decision not to order the relief removed can still be appealed against in Germany’s highest court, the federal court of justice.