Hungary's government says the loans exploit ordinary Hungarians, and wants to implement a relief scheme, for which the banks would probably have to foot the bill. It is waiting for legal issues to be ironed out before moving ahead.

Bank stocks fell after the European Court opinion was announced, but the losses were limited because the market expects that any decisions that could substantially hurt the banks' bottom line will come later.

Hungary's supreme court has already ruled on the main legal issue, finding that lenders were not to blame when borrowers lost out because the exchange rate changed.

That was a partial reprieve for the banking sector, which is largely foreign-owned and includes the units of lenders such as Raiffeisen (>> Raiffeisen Bank International AG), Erste Bank (>> Erste Group Bank AG) and Unicredit (>> UniCredit SpA).

The European court was asked to rule on a secondary issue, which relates to whether a bank treated a customer unfairly by issuing a mortgage at one exchange rate, and setting a different one for the repayments.

The opinion of the EU court issued on Wednesday is not binding until the judges themselves have ruled. It stated that under European laws Hungary's national courts can intervene where contract terms are deemed to be unfair.

MARKET WORRIES

Analysts say that Hungary is vulnerable to a potential sell-off by investors worried about turbulence in emerging markets, and they say a mortgage relief scheme that hurts the banks badly could add to investor concerns.

The shares of OTP Bank (>> OTP Bank Nyrt.), Hungary's largest lender, were down 1.7 percent at 4,190 forints at 1035 GMT.

Analysts said the losses were contained as it would take months for the EU court to make its definitive ruling, and then for a Hungarian court to decide on the issue.

"There was a little panic but then OTP started to recover," Equilor analyst Akos Kuti said.

Prime Minister Viktor Orban, who opinion polls show will be re-elected for a new four-year term in April, has said the government is determined to provide help to struggling holders of foreign currency mortgages.

Hundreds of thousands of Hungarians took out mortgages denominated in euros or Swiss francs because they were the cheapest option available at the time, and then saw their debt balloon when the Hungarian forint fell in value.

The banks are already reeling from a previous, government-imposed scheme that cost banks over 1 billion euros in losses.

The next stage in the complex legal manoeuvring around the foreign currency loans is a ruling expected from the Hungarian supreme court, known as the Kuria, on a separate set of questions.

These are the fairness of the mortgage contracts and the issue of whether the banks were sufficiently transparent about unilateral changes to the loans' terms, such as the interest rate.

That decision, and separate guidance expected from the Constitutional Court, could serve as basis for further government measures to help borrowers.

For markets, the ruling on interest rates "is the story," said Norbert Harcsa, an analyst at brokerage Ipopema.

(Reporting by Krisztina Than and Marton Dunai; Editing by Christian Lowe)