Italy's courts were wrong to allow victims of Nazi war crimes to claim compensation against Germany, the highest U.N. court ruled Friday, given that Germany has immunity under international law.

The ruling by the International Court of Justice in The Hague is expected to end a wave of claims for damages arising from a Nazi massacre in Italy during World War Two, and will also prevent other countries such as Greece from using Italy's courts to pursue a flood of similar compensation claims.

Italy's highest court ruled in 2008 that Germany should pay around 1 million euros ($1.31 million) in compensation to the families of nine victims of the killings, committed by the German army in Civitella, Tuscany. A total of 203 people died in the 1944 massacre.

The Italian Republic has violated its obligation to respect the immunity which the Federal Republic of Germany enjoys under international law by allowing civil claims to be brought against it based on violations of international humanitarian law committed by the German Reich between 1943 and 1945, the ICJ said in a statement.

The ICJ, set up in 1945 as a world court for disputes between nations, ordered Italy to ensure that the decisions which were taken by its courts and which infringed Germany's immunity under international law cease to have effect.

Germany, which filed the lawsuit against Italy at the ICJ in December 2008, welcomed the ruling.

The proceedings were never aimed at the victims of National Socialism - the German government has always recognized their suffering to the fullest extent, said German Foreign Minister Guido Westerwelle, who was in Munich for the international security conference.

Compensation for injustice was carried out in line with international law after World War Two, in the extensive peace and reparations treaties with affected countries, he added.

Germany has paid billions of euros in reparations and compensation since the war's end in 1945.

The dispute between the two countries arose after an Italian court ruled that Luigi Ferrini, an Italian who was deported to Germany and forced to work in the armaments industry, was entitled to compensation from the German government.

The case led to a flood of other claims from victims of Nazi war crimes in Italy.

It eventually prompted Germany to file a lawsuit against Italy at the ICJ saying that the Italian court had erred in ordering Berlin to pay damages for the massacre and that by allowing the ruling to stand, hundreds of additional cases could be brought against it by private individuals.

In a way, we expected it, Italy's representative, Paolo Pucci di Benisichi, told reporters after the court ruling. ($1 = 0.7621 euros)

(Reporting by Sara Webb; Additional reporting by Svebor Kranjc in The Hague and Sabine Siebold in Munich; editing by Michael Roddy)