* ECB adopts legal opinion on Hungarian loans legislation
* Says retroactive effect not in line with relevant EU rule
* Warns of risks from new measures, planned fx loans conversion (Adds more comments from ECB, background)
BUDAPEST, Aug 6 Hungary's plans to force banks to refund borrowers for overcharging could hurt financial stability and the authorities should consider the effects carefully when drawing up further measures, the European Central Bank said.
The central bank, in a legal opinion signed by President Mario Draghi, also said the retroactive effect of the Hungarian legislation did not seem to be in line with the relevant EU directive.
A Hungarian court ruled in June that banks had previously overcharged customers for some loans and a law drafted by Prime Minister Viktor Orban's government and passed last month will force banks to repay customers for unfair charges and interest rate hikes on loans. That is likely to result in big losses for Hungary's mostly foreign-owned banks.
The National Bank of Hungary has estimated that the compensation could cost the banking sector about 900 billion Hungarian forint ($3.82 billion). The main foreign banks include Austria's Erste and Raiffeisen, Italy's Intesa and Belgium's KBC.
The ECB, in its legal opinion dated July 28 but published on its website late on Tuesday, said the potentially significant costs of the new measures "may in some cases require material capital injections from the owners of the financial institutions."
"The ECB suggests that the Hungarian authorities carry out a thorough analysis of the possible effects of the measures having retroactive effect, as such measures could put a significant strain on the banking sector, potentially adversely affecting the stability of the Hungarian financial sector as a whole," it said.
Parliament's approval of the bill in July is the first legislative step of a relief scheme for borrowers, which will later include a conversion of all foreign currency loans into forints, the government has said.
These loans, mostly taken up in Swiss francs, were once popular for their low interest rates but many borrowers were caught out during the global financial crisis when the forint weakened, pushing their repayment costs much higher. Orban now wants to resolve the problem for good.
The government has said that the next batch of legislation, which will lay out how banks will have to settle the refunds with borrowers, will be submitted parliament in the autumn.
The ECB said that this settlement process and the planned conversion of forex loans into forints could pose risks and Budapest should take these into account.
"In particular, further measures to be applied to the planned conversion of FX loans should also take into account the need to preserve financial stability, ensure an appropriate burden sharing among all stakeholders and avoid moral hazard in the future," the ECB said.
Depending on the nature of further measures on the repayment or write-down of funds to be repaid to customers, "cross-border spillover effects on banking groups' consolidated profits and capital positions may occur."
"In addition to the possible significant adverse financial impact on the banking system, the possibility of negative effects on the Hungarian economy and financial markets cannot be excluded," the ECB said. (1 US dollar = 235.8000 Hungarian forint) (Reporting by Krisztina Than and Sandor Peto; Editing by Susan Fenton)