Hungary’s supreme court, the Kúria, on Thursday ruled that a foreign exchange-denominated loan contract is valid, but said the exchange rate margin in the agreement must be limited to plus or minus half of a percent.

The case was brought against OTP Bank by a borrower who argued that the cost of the exchange rate margin was not indicated in the loan contract and should be annulled. A district court in the capital ruled against the borrower in April 2012, but the Budapest court of appeals ruled for the borrower in December. OTP Bank, Hungary’s biggest commercial lender, then turned to the Kúria.

Much of Hungarian banks’ corporate and consumer lending stock is denominated in foreign currency. FX loans were earlier popular because they had lower interest rates than forint loans. However, after a sharp weakening of the forint, repayments grew and many FX loans became non-performing. Although Hungary’s legal system is based on codified law, financial market watchdog PSZAF warned earlier that a ruling annulling the FX loan contract could still set a dangerous precedent. Annulling such contracts en masse could lead to a default by the state of Hungary in an extreme scenario, it said.

OTP Bank’s share price rose after the decision was announced. Its shares traded at HUF 4,780, up 3.9%, at 3:23 in the afternoon.