Never in its 64 years had the Cannes Film Festival named anyone “persona non grata,” having saved that dubious distinction for Lars von Trier on Thursday.

Organizers hinted that the famously contrarian Dane could be back — someday — and spared his film, “Melancholia,” which is still in the running for the Palme d’Or. But should the Robert De Niro-led jury award von Trier the top prize for a second time (his “Dancer in the Dark” triumphed in 2000), he definitely won’t be welcome to retrieve it.

After he labeled himself a Nazi and expressed sympathy for Adolf Hitler at a “Melancholia”news conference the morning before, officials on Thursday banned him from all events at the festival, which concludes with Sunday’s awards ceremony.

“The Festival de Cannes provides artists from around the world with an exceptional forum to present their works and defend freedom of expression and creation,” the fest said in a statement. “The board of directors profoundly regrets that this forum has been used by Lars von Trier to express comments that are unacceptable, intolerable and contrary to the ideals of humanity and generosity that preside over the very existence of the festival. The board of directors firmly condemns these comments and declares Lars von Trier a persona non grata at the Festival de Cannes, with effect immediately.”

The harsh rebuke didn’t seem to rattle von Trier, who backed off his comments in an apology — “I am not anti-Semitic or racially prejudiced in any way, nor am I a Nazi,” he said — but predictably clung to an air of defiance and, as “Melancholia” producer Meta Foldager told the AFP news service, “accepts whatever the festival directors want to do to punish him.”

Magnolia, which acquired North American rights to “Melancholia” in February, has no plans to punish the helmer. A spokesman for the banner said it will stick to its fall release for the pic, which it bought in a seven-figure deal at the European Film Market. One Argentine distributor, however, said it was backing away, citing von Trier’s comments.

Von Trier’s banishment from Cannes may not be permanent, a festival spokesman told Variety — and if it were, the festival would lose a familiar face, as the filmmaker has premiered all but one of his features on the Croisette.

He’s also made a point to kick up controversy in years past, including during his 2005 Cannes press conference for his slavery-themed pic “Manderlay.”

“The U.S. is a country I’ve never been to, except in my mind,” he said then. “But this film could just as well be about the American military in Denmark. We are a nation under influence, also a very bad influence, because President Bush is an asshole doing lots of idiotic things. … And what makes me sad is that there’s a black president on practically every American TV show. All this political correctness! You can’t be a bad black guy! But there is no black president!”

A year after history debunked that notion, von Trier returned to Cannes with “Antichrist,” the undisputed bete noir of 2009’s fest. Von Trier was booed and reviled for its depictions of sadomasochistic sex, genital mutilation and other graphic themes, criticism he once again shrugged off: “I don’t think I have to justify it,” said the filmmaker, who has the letters F, U, C and K tattooed atop his fist. “I don’t think I owe anyone an explanation. I never had a choice — it’s the hand of God, I’m afraid.”

Outside von Trier’s offerings, Cannes has weathered its share of controversial films (“Brown Bunny” in 2003 is but one example), and hot-button issues have wormed into the politics-shy fest before. Michael Moore’s “Fahrenheit 9/11” won the top prize in 2004, prompting then-fest head Gilles Jacob to later call for winners to be picked based on filmmaking, not politics. And last year, fest and jury marked the imprisonment of helmer Jafar Panahi in Iran with program notes of support and an empty chair at the awards presentation.

Von Trier’s exit was not abrupt but unfolded over two days beginning with his Wednesday-morning comments that came in response to a question about his German heritage. Von Trier recalled how he once believed he was Jewish but that his mother told him that his real father was in fact German.

“I really wanted to be a Jew, and then I found out that I was really a Nazi,” he said, adding that he “understands” Hitler. “He’s not what you would call a good guy. But I understand much about him, I sympathize with him a little bit.”

Later that night, he attended the film’s official premiere, walking the red carpet to warm applause and taking in more ovations as the pic — firmly considered a favorite for the Palme d’Or — concluded. But the afterparties were canceled, and the festival demanded an explanation.

The director issued his apology the following day, but it wasn’t enough to hold off angry organizers, including general delegate Thierry Fremaux, who was known to have been personally disturbed by the comments and was said to have rebuffed von Trier’s apology.

Whether von Trier can appease his collaborators on upcoming projects will remain to be seen. He’s been planning to collaborate with Martin Scorsese on doc “The Five Obstructions,” and told Blighty press that he’s working on “The Nymphomaniac,” a story about a woman’s sexual awakening.

Reps for Scorsese and entities associated with that project were not available for comment Thursday.

Elsa Keslassy contributed to this report.