CANNES, France - Danish filmmaker Lars von Trier was booted out of the Cannes Film Festival on Thursday for a bizarre, rambling news conference in which he said he sympathizes with Adolf Hitler.

The comments had ignited shock from the moment they spilled out of the director's mouth, causing Kirsten Dunst, an actress in his film "Melancholia," to lean over and whisper to von Trier, "Oh my God, this is terrible."

Festival President Gilles Jacob said von Trier had been banned from the rest of this year's festival, although he would not elaborate if the filmmaker might be allowed back in the future. It was an unprecedented move by the festival, which in 2000 had bestowed its highest honour on von Trier's earlier film, "Dancer in the Dark."

The filmmaker's comments had "stained the reputation for the festival" and its 28-member board of directors felt it had to respond, Jacob said.

Von Trier's current film "Melancholia" remains in competition for all Cannes prizes -- including the top Palme d'Or award -- but if it wins any he will not be allowed to attend Sunday's closing ceremony.

At a news conference for the film Wednesday, von Trier spoke about his German heritage, and in a rambling speech said he understood and sympathized with Hitler. The director said afterward he had been joking and later issued an apology.

Thierry Fremaux, the general director at Cannes, said von Trier told festival officials that he "accepts the punishment."

"He's upset by this matter," Fremaux said. "He recognized that the festival had to take a firm position in regards to his comments."

Jacob said the board considered throwing "Melancholia" out of the festival but it decided to "distinguish between the work and the person."

The decision should not affect the nine-member jury's deliberations, Fremaux said, adding, they "must judge the films in all sovereignty according to whatever criteria they like." He added that the festival's organizers "don't have direct contact" with the jury, which is headed by Robert De Niro and includes Uma Thurman and Jude Law.

A festival statement said the Cannes board "firmly condemns these comments and declares Lars von Trier a persona non grata at the festival."

The festival "provides artists from around the world with an exceptional forum to present their works and defend freedom of expression and creation," the statement said. The board "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."

Von Trier told reporters at the "Melancholia" news conference that he had some compassion for Hitler.

"What can I say? I understand Hitler, but I think he did some wrong things, yes, absolutely. But I can see him sitting in his bunker in the end," von Trier said. "He's not what you would call a good guy, but I understand much about him, and I sympathize with him a little bit. But come on, I'm not for the Second World War, and I'm not against Jews. ...

"I am very much for Jews. No, not too much, because Israel is a pain in the ass."

Von Trier went on to say he also admired Hitler aide Albert Speer.

Cast members of "Melancholia," including Dunst, Charlotte Gainsbourg and John Hurt, sat uncomfortably alongside von Trier as the director made his Hitler remarks.

But "Melanchola" co-star Stellan Skarsgard, who has worked on four past von Trier films along with some television projects, defended the director Thursday, saying "it's embarrassing for the Cannes Film Festival that they behave like this."

"Everybody knows he's not a Nazi. So what are they punishing him for? Lying? Saying he was a Nazi? Joking?" Skarsgard told Associated Press Television News. "It's a storm in a teacup, and it's absolutely silly. And that the festival doesn't have more spine than stand against all those upset feelings that have no ground, that is ridiculous, and it's unworthy of the festival to do something like that."

In an interview after the news conference, von Trier said he had been joking and that the remarks had spilled out without any forethought.

"I don't have so much to say, so I kind of have to improvise a little and just to let the feelings I have kind of come out into words," von Trier told The Associated Press. "This whole Nazi thing, I don't know where it came from, but you spend a lot of time in Germany, you sometimes want to feel a little free and just talk about this (expletive), you know?"

Jewish groups condemned von Trier's remarks and applauded the festival's measures Thursday.

"This is a welcome action, which declares to the world that the suffering of victims is not a fit subject for mockery or casual self-promotion," Elan Steinberg, vice-president of the American Gathering of Holocaust Survivors and their Descendants, said in a statement. "The organizers of the Cannes film festival have eloquently taken a determined moral stand against cavalier expressions of hate and insensitivity to those brutalized by the Nazis -- Jew and non-Jew."

Noting that von Trier's wife is Jewish and his children have Jewish names, Fremaux said the director told festival officials he really thinks the Holocaust was the most serious event of recent history.

Dunst, who plays a deeply depressed woman in von Trier's apocalyptic film about a planet on collision course with Earth, said von Trier was embarrassed by the remarks and that the festival's action made sense.

"I understand why they had to make that decision," Dunst told AP Television News. "It's unfortunate, but he, you know, joked about that. It's very inappropriate."

Von Trier has been a festival favourite who has had nine films in the Cannes main competition since 1984, among them "Dogville," "Manderlay" and "Breaking the Waves," which won the second-place grand prize in 1996. Von Trier's 2009 entry "Antichrist" earned the festival's best-actress award for Gainsbourg.

Henrik Bo Nielsen, director of the Danish Film Institute, said his group found von Trier's comments offensive but they would not affect its decisions to fund the director's future films.

"It is unfortunate that great cinema should drown in such farce and controversy totally irrelevant to the film itself," Nielsen said. "But there's nothing new in the fact that great artists make stupid and repugnant remarks."

Associated Press Writer Jenny Barchfield and APTN reporter Zara Younis contributed to this report.