A two-years-old European Union decision to share personal information about passengers flying from the EU to the US with American authorities is illegal, the European Court of Justice ruled Tuesday.

The decision to share passenger records, including personal details such as names, addresses and travel schedules, was a response to the 911 attacks and aimed to help the US pursue its so-called "war on terrorism."

The European Parliament opposed the agreement, which was brokered by the European Commission, and approved by the 25 national governments.

The Parliament appealed to the Court of Justice in Luxembourg, claiming that the Commission was wrong to conclude that European citizens' personal data would be adequately protected by US authorities, and that the national governments were wrong to approve the agreement to transfer the data in May 2004.

The Court agreed with both claims by the Parliament and overruled both the Commission and the Council of national governments. "Neither the Commission decision nor the Council decision are founded on an appropriate legal basis," the Court said in a statement.

The overturning of the decisions marks a victory for civil liberties activists, but it leaves travel companies, especially the airlines that must collect the passenger data and hand it over to US authorities, in a legal quandary.

Under US laws passed after September 11, 2001, airlines can be fined for failing to hand over such information.

The Court gave the Commission and the Council until September 30 to find another solution. The agreements signed two years ago will remain in place for another four months, it said, "for reasons of legal certainty," while European legislators seek an alternative.

Some national governments including Blair’s UK government are considering reaching their own data-sharing deal with the US.

A US official said: "We are working with the Commission and we will make the best efforts to find an agreed interim approach to data transfers which fully respect the ruling." The official said the US government remains committed to the “principle” of privacy.