BRUSSELS- The European Union’s top court ruled yesterday that Athens was violating EU law by giving Greek oil refineries an advantage over foreign refineries in selling oil in Greece. The Luxembourg-based European Court of Justice said that the Greek system for storing emergency reserves of petroleum and products is not compatible with the principle of the free movement of goods and discriminated against foreign oil refineries. The ruling did not spell out what Athens had to do to comply. Court officials said that the European Commission, which had brought the case to the court, would have to work out details of compliance with Athens. Under EU rules, member states have to store at least 90 days’ emergency stocks of oil and oil products. The stocks are meant to be put together by oil marketing companies. But under Greek law since 1996, marketing companies can hand their storage obligations to refineries in Greece, in proportion to how much oil they bought from the refineries the previous year. The Commission argued that the system encouraged marketing companies to buy from Greek refineries. Athens had argued that the system helped guarantee secure supplies of petroleum, even if it was an obstacle to the free movement of goods. The Court considers that the security objectives cited by Greece could be achieved by less restrictive measures, the court said in a statement. The Court can impose fines on member states if they do not comply. That power has been used only once, however, when the court in July 2000 fined Greece 20,000 euros ($17,840) per day for failing to clean up a garbage dump on Crete.