French writer Michel Houellebecq has been cleared of inciting racial hatred by saying Islam was "the stupidest religion".
A panel of three judges in Paris declared that the author was not guilty after he was sued by four Muslim groups.
He made the comments in an interview with the literary magazine Lire in 2001.
The case was seen as an important battle between free speech and religious conservatism.
Houellebecq, who won the Impac literary prize in May, could have faced up to 18 months in jail or a 70,000 euro (£44,000) fine if found guilty.
The court ruled that although the author's comments were "without a doubt characterised by neither a particularly noble outlook nor by the subtlety of their phrasing," they did not constitute a punishable offence.
The court agreed with Houellebecq's defence that the "dumbest" remark "did not contain any intent to verbally abuse, show contempt for or insult the followers of the religion in question".
'Islamophobia'
It ruled that while Houellebecq had expressed hatred for Islam, he did not express hatred for Muslims, and did not encourage others to share his views or discriminate.
But the Muslim groups, including France's Human Rights League, said his comments amounted to "Islamophobia".
In the interview, Houellebecq said: "The stupidest religion, after all, is Islam.
"When you read the Koran, you're shattered. The Bible at least is beautifully written because the Jews have a heck of a literary talent."
He also described Islam as "a dangerous religion right from the start".
When he appeared in court to answer the charges in September, he said he felt contempt - not hatred - for Islam.
Humiliated
"I have never displayed the least contempt for Muslims," he said.
"I have as much contempt as ever for Islam."
He added: "I am always changing my point of view."
The author said he opposed not just Islam but all faiths that believed there was just one God.
It was his right as an author to criticise religions, he said.
Dalil Boubakeur from the Paris mosque told the court: "Islam has been reviled, attacked with hateful words. My community has been humiliated."
The groups suing the author also included Saudi Arabia's World Islamic League, the National Federation of French Muslims and the Lyon mosque.
The groups are considering appealing against the court's decision.
The main character in Houellebecq's novel Platform admits to a "quiver of glee" every time a "Palestinian terrorist" is killed.
In 2001, the author said he had "a gift" for insults and provocation.
British author Salman Rushdie was one of Houellebecq's most vocal supporters, writing in the Washington Post that a guilty verdict for Houellebecq would be a blow to free speech.