A Nazi salute is not illegal racial discrimination provided that it is intended as a personal statement, Switzerland's top court ruled .

The federal tribunal's ruling, entitled Hitler salute in public not always punishable, said on Wednesday that the gesture was a crime only if someone was using it to spread racist ideology, not simply declaring one's own conviction.

The ruling by the Lausanne-based court overturned the conviction last year by a lower court of a man who was charged with racial discrimination after he took part in an August 2010 demonstration with 150 participants.

The demonstration took place a week after Swiss National Day was marked on the Rütli meadow above Lake Lucerne where, according to legend, the Swiss Confederation was born in 1291.

The court said the man substituted the Swiss oath with a 20-second Nazi salute. But it said the gesture was only punishable if it was being used to spread, advertise or propagate racist ideology with the intention of influencing others.

The gesture is a criminal offence in Germany, Austria and the Czech Republic. A Swiss law in 1995 forbids racist symbols to be displayed to promote racist ideologies.

For more than a decade, the Swiss have grappled with right-wing extremists disrupting Swiss National Day celebrations on Rütli with Nazi symbols.

The August 2010 incident occurred two months after the Swiss federal council of seven ministers, including the president, decided not to ban the Nazi salute and swastika symbol in Switzerland. A federal anti-racism commission called that a bad decision that would have "serious consequences",

In another ruling on racism issues, the court said earlier this year that calling someone "foreign swine" or "filthy asylum seeker" may be insulting, but because the expressions are widely used insults in the German language, they do not constitute racist attacks.