By Margit Feher

BUDAPEST--The Court of Justice of the European Union ruled Thursday that Hungarian oil and gas company MOL Nyrt. (MOL.BU) didn't receive state aid from the Hungarian government related to its mining fees, a decision that allows the company to retain 96.6 million euros ($108 million).

The ruling ends an issue that MOL and the European Commission, the EU's executive branch, have been at loggerheads over for several years.

The Court of Justice ruled that an agreement in 2005 between the Hungarian government and the oil company MOL relating to the exploitation of hydrocarbon fields doesn't constitute state aid. The court said the combination of that agreement and the increase in the rate of mining fees didn't confer a selective advantage on MOL.

The commission had claimed the 2005 agreement, which fixed the rate of the mining fee for MOL, together with the increase of the mining fee had the effect of favoring MOL over its competitors and therefore constituted state aid incompatible with the common market. Consequently, the commission asked Hungary to recover that aid from MOL, which amounted to about EUR96.6 million for 2008 and about EUR6.6 million for 2009.

Write to Margit Feher at margit.feher@wsj.com; Twitter: @margitfeher

Subscribe to WSJ: http://online.wsj.com?mod=djnwires