Irish politician and Sinn Fein leader Gerry Adams used a racial slur on his Twitter account late Sunday, days before his party is to contest regional elections in Northern Ireland.
His tweet compared a former slave's struggle against slave-owners in the Quentin Tarantino film "Django Unchained" with the treatment of Irish nationalists in a Catholic area of Belfast, Ballymurphy.
"Watching Django Unchained -- A Ballymurphy Nigger!" Adams tweeted.
A second message read "Django -- an uppity Fenian!"
Both tweets were deleted shortly after being posted but had already been widely shared and criticised.
"So this is acceptable is it?" asked Peter O'Brien, a Labour Party councillor in Ireland.
"What was @GerryAdamsSF thinking? A remarkably ignorant, ill-informed and racist tweet. He should be ashamed of himself" wrote Daniel Pitt.
Reacting to the furore, Adams said his use of the "N-word" was ironic.
"Anyone who has seen the film, as I did last evening, and who is familiar with the plight of nationalists in the north until recently, would know that my tweets about the film and the use of the N-word were ironic and not intended to cause any offence whatsoever," he said in a Sinn Fein statement emailed to AFP.
"Attempts to suggest that I am a racist are without credibility. I am opposed to racism and have been all my life," he said.
"The fact is that nationalists in the north, including those from Ballymurphy, were treated in much the same way as African Americans until we stood up for ourselves."
Ballymurphy is known as the site of 1971 killings of civilians by British soldiers during the "Troubles" in Northern Ireland, three decades of largely sectarian violence in which 3,500 people died.
"If anyone is genuinely offended by my use of the N-word they misunderstand or misrepresent the context in which it was used. For this reason I deleted the tweets," Adams said.
Opinion polls indicate Sinn Fein is likely to win about a quarter of the votes in Thursday's election for the Northern Ireland Assembly, where the republican party has been in power alongside the pro-British Democratic Unionist Party since 2007.