(Bloomberg) — Dutch Freedom Party Leader Geert Wilders was acquitted by a court of charges that he made remarks defaming Muslims, ending a three-year prosecution that he described as a bid to restrict his freedom of speech.

Wilders, 47, was charged with inciting hatred and discrimination and insulting Muslims for calling the Koran “fascist” and comparing it to Adolf Hitler’s book “Mein Kampf” in a 2007 Dutch newspaper editorial. A year later, he released his movie “Fitna,” in which he urged Muslims to rip out “hate-preaching” verses from the book.

“You have spoken in a hurtful and also shocking way,” Presiding Judge Marcel van Oosten said in the Amsterdam district court today. Even so, “the court finds, in the broadest context, that you have to be able to propagate the message of such a film.”

The movie led to protests in Islamic-majority countries including Indonesia and Pakistan and prompted Malaysians to call for a boycott of products from the euro area’s second largest exporter. Wilders, whose party backs the minority Dutch coalition government, has been under constant police protection since a Muslim radical murdered filmmaker Theo van Gogh in 2004.

“Today is a victory for freedom of speech,” Wilders said on its website today. “The Dutch are still allowed to speak critically about Islam, and resistance against Islamization is not a crime.”

Prosecutors, who were forced to file charges against Wilders by a higher court, also called for the politician to be cleared, saying his criticism was aimed at Islam as a religion and not at Muslims.