By Ed Cropley
JOHANNESBURG (Reuters) - South Africa's ruling African National Congress (ANC) pledged on Wednesday to stop its supporters singing the "Shoot the Boer" anti-apartheid anthem to avoid upsetting white farmers and stirring racial tension.
The agreement between the ANC and white-minority interest group Afriforum ends a two-year legal battle over the song that had ignited a debate about freedom of speech, censorship of history and efforts to mend the racist rifts in South African society.
The liberation-era song calls on the oppressed black majority to gun down the boers, or white Afrikaner farmers who were among apartheid's staunchest supporters.
A Johannesburg High Court ruled last year that it was "hate speech" after then-ANC youth leader Julius Malema - who has since been expelled from the party for ill-discipline - sang it at several public meetings.
An ANC appeal against that ruling was due to start in the Supreme Court on Thursday. The two sides instead agreed to sit down and reach a deal rather than ask the courts to decide on a topic as thorny as "banning" a song known to nearly every adult black South African.
"The ANC commits itself not to sing this song," Secretary-General Gwede Mantashe told a news conference, flanked by Afriforum lawyers and leaders of the Transvaal Agricultural Union, a white farmers' group.
He also made clear the agreement covered other potentially hurtful songs, saying party leaders would "encourage its members to have some restraint and avoid singing lyrics that will hurt feelings".
The deal is a rare compromise between the ANC and the white Afrikaans-speaking minority, which has sometimes struggled to feel at home in Nelson Mandela's post-apartheid "Rainbow Nation".
Although most South Africans treat each other with respect 18 years after the end of apartheid, racism by whites occasionally rears its head, and Afriforum said it would do its best to stamp out such slurs.
"It's not an eradication of freedom of expression. It's an eradication of polarization in our society," Afriforum chief executive Kallie Kriel said.
Afriforum had argued that Malema's renditions of the song might be exacerbating attacks on white farmers, although the ANC countered that it was not about individuals but a system that should be eliminated.
After the High Court ruling, Malema continued to sing the song but with the words "shoot the boer" changed to "kiss the boer".
(Reporting by Ed Cropley; Editing by Angus MacSwan)