South Africa's high court has ruled that the anti-apartheid song Shoot the Boer is hate speech and banned the ruling ANC from singing it.
Afrikaans interest group Afriforum had complained about ANC youth league leader Julius Malema singing the song, which refers to white farmers.
Mr Malema and other ANC leaders had argued that the song was a celebration of the fight against minority rule.
They said the words were not meant to be taken literally.
The high court upheld a ruling by a lower court and ordered Mr Malema to pay legal costs.
"Those words are derogatory, dehumanising," said judge Collin Lamont, adding that in post-apartheid South Africa, all citizens are called to treat each other equally.
He urged the ANC to find new customs which did not bring disunity.
The BBC's Karen Allen in Johannesburg says the ruling comes as a blow to Mr Malema, who has made the song his signature tune.
The 30-year-old populist, now a critic of President Jacob Zuma, is also facing an ANC internal disciplinary hearing, which could see him expelled from the party.
Although he is seen as a maverick within his own party, when evidence was heard in the high court earlier this year, a string of ANC grandees queued up to defend him, she says.
He has previously been convicted of hate speech after saying a woman who had accused Mr Zuma of rape had had "a nice time". Mr Zuma was acquitted.
The ANC has said it is appalled at the judgement, which it calls "an attempt to rewrite" South Africa's history.
Afriforum head Kallie Kriel, however, welcomed the ruling.
"This is a victory for the promotion of mutual respect and dignity of communities, over the culture of disrespect that Julius Malema is sowing around the country."
Mr Malema was not in court to hear the verdict and does not face any further punishment as it was a civil case.
Mr Malema faces more cross-questioning on Tuesday when the ANC disciplinary hearing against him resumes.
If found guilty of a number of charges he could be expelled from the party altogether, as he is already on probation after criticising President Zuma last year.
Mr Malema's latest ANC charges relate to his call for regime change in neighbouring Botswana, which runs against both government and ANC policy.
He fell out with Mr Zuma after accusing him of not doing enough for the poor black South Africans - his main support group in the 2009 elections which brought him to power.
Mr Malema wants him to nationalise South Africa's rich mines and seize white-owned land. He has praised President Robert Mugabe's land reform in neighbouring Zimbabwe.
Mr Malema is also being investigated by state prosecutors on allegations of fraud and corruption, which he denies.