The draft law, which EU diplomats called a minimalist compromise, gained approval after six years of emotional negotiations, during which countries with vastly different legal cultures struggled to reconcile the protection of freedom of speech with protection of their citizens from racism and hate crimes.
The legislation calls for jail terms of as much as three years for "intentional conduct" that incites violence or hatred against a person's "race, color, religion, descent or national or ethnic origin." The same punishment would apply to those who incite violence by "denying or grossly trivializing crimes of genocide, crimes against humanity and war crimes."
EU officials said that the law was notable for what it omitted.
Fearing that the legislation could be hijacked by groups trying to right historical wrongs, a majority of EU countries rejected a demand by the formerly communist Baltic countries that the law criminalize the denial of atrocities committed by Stalin during Soviet times. As a political gesture, however, Franco Frattini, the EU's justice commissioner, said the EU would organize public hearings on the "horrible crimes" of the Stalin era in the coming months.
The scope of the law also does not cover other historical events, like the massacre of Armenians during the First World War by Ottoman Turks, which Armenians call a genocide. Instead, the legislation recognized only genocides that fall under the statutes of the International Criminal Court in The Hague, like the mass killing of Jews during World War II and the massacre in Rwanda in 1994.
There will be no Europe-wide ban on the use of Nazi symbols, one of the original intentions of the law's drafters, which gained force two years ago after the release of photographs of Prince Harry of Britain wearing a swastika armband at a costume party.
EU officials involved in the drafting of the law, which needed unanimous approval, said consensus had been achieved by allowing national laws to take precedence. Britain, Sweden and Denmark, which have particularly libertarian traditions, pressed for wording that would avoid criminalizing debates about the Holocaust and would ensure that films and plays about the Holocaust, like Roberto Benigni's award-winning "Life is Beautiful" and Mel Brooks's musical "The Producers," were not censored.
The legislation also states that individual countries' constitutional protections of freedom of speech would be upheld, meaning, for example, that publishing caricatures of the Prophet Muhammad in Denmark, where freedom of speech is enshrined in the Constitution, is permitted under the law.
Denmark and Britain also pressed successfully for a provision to ensure that attacks on religions are covered only when they are of a xenophobic or racist nature.
Anti-racism groups said the law had been watered down to the point of rendering it toothless.
Michael Privot, spokesman for the European Network Against Racism, said, for example, that a person publishing a pamphlet denying the Holocaust could do so with impunity in Britain, while still facing prosecution in France. "We have ended up with a lowest common denominator law," he said.
Laws against denying the Holocaust exist in Austria, Belgium, France, Germany and Spain, and in many cases the national legislation goes much further than the new EU rules. In a recent high-profile case, the British historian David Irving spent 13 months in jail in Austria for challenging the Holocaust before being released in December.
Two years ago, Luxembourg tried to use its EU presidency to push through Europe-wide anti-racism legislation, but it was blocked by the center-right government then in power in Italy on the grounds that it threatened freedom of speech. The proposed law was considered too politically difficult to pass until it was taken up by Germany, current holder of the EU's rotating presidency, which has called it a historical obligation and a moral imperative.
Friso Roscam Abbing, spokesman for Frattini, the EU's justice commissioner, said it was inevitable that the bill be diluted, given the need to reconcile so many different political and legal cultures. But he added: "We still think it is useful and sends a strong political signal that there is no safe haven in Europe for racism, anti-Semitism or Islam-phobia."
But Muslim leaders accused the EU of having double standards, arguing that it protects established Christian religions and outlaws anti-Semitism while doing nothing to defend Muslims against defamation.