PARIS, March 22 — A French court ruled Thursday in favor of a satirical weekly newspaper that faced charges brought by two Muslim groups after it published cartoons featuring the Prophet Muhammad that had caused an international uproar when a Danish newspaper published most of them.
The charges, brought by the Paris Mosque and the Union of Islamic Organizations of France, accused the newspaper, Charlie Hebdo, and its editor, Philippe Val, of “publicly abusing a group of people because of their religion.”
The charges could have resulted in a six-month prison term for Mr. Val and a fine of about $29,000 against the newspaper.
In its Feb. 8, 2006, issue, Charlie Hebdo republished 12 drawings that appeared in September 2005 in the Danish newspaper Jyllands-Posten, some of them lampooning the Prophet Muhammad. The publication in Denmark set off deadly rioting across parts of the Muslim world and resulted in Muslim boycotts of Danish products.
Charlie Hebdo published the cartoons in solidarity with the Danish newspaper and to make a point about freedom of expression in France, which has the largest Muslim population in Europe.

On the cover of its Feb. 8, 2006, issue, Charlie Hebdo published an original drawing by the French cartoonist Cabu depicting a crying Muhammad with his head in his hands, saying, “It’s hard to be loved by idiots.”
The publication in France set off a public debate on the country’s devotion to its secular ideals. While France has limits on public expression, particularly with regard to racist speech, enforcement varies according to the national mood and penalties for infractions are usually low.
The court acknowledged that one of the cartoons, which depicted Muhammad wearing a turban shaped like a bomb, might offend some Muslims. But it said that, given the context of its publication, it saw no “deliberate intention of directly and gratuitously offending the Muslim community.”
Last September, a Danish court rejected a similar lawsuit against Jyllands-Posten.
Mr. Val called the ruling a victory for freedom of speech and secular French Muslims.
The Union of Islamic Organizations of France said it would appeal the decision. The Paris Mosque said through its lawyer that it probably would not.