BRUSSELS—The European Union's highest court said on Thursday that Internet service providers may have to block access to websites that infringe copyrights.

The ruling, which confirms an opinion last year from the European Court of Justice's advocate general, could raise costs for Internet service providers in the 28-country EU, but leaves leeway for national courts to decide on the best course of action to fight copyright violations.

The ECJ had been asked to give its interpretation of the bloc's copyrights law by Austria's highest court. That court is hearing a case between Austrian Internet provider UPC Telekabel Wien GmbH on the one side and two movie companies, Germany's Constantin Film Verleih GmbH and Austria's Wega-Filmproduktionsgesellschaft mbH, on the other.

The two movie companies wanted UPC to block access to kino.to, an site that allowed users to stream or download movies under their copyright.

UPC argued that it shouldn't be responsible for policing copyrights on a site that was completely separate from its own operations and where there was no court ruling establishing unlawful actions by its own customers. It said any blocking measures could easily be circumvented by users and would be excessively expensive.