A British appeals court ruled in favor of retailers including J Sainsbury Plc in a blow to credit card firms that could now face billions of pounds in damages.

The fees fixed by Visa Inc. and Mastercard Inc. restrict competition and are unlawful, Judge Terence Etherton said today in London.

The ruling, which also involved Wal-Mart Stores Inc.’s Asda and Wm Morrison Supermarkets Plc, resolved wildly different decisions by judges in the lower courts. The case now goes back to a specialty competition judge to reconsider whether the restrictive practices were justified in the interests of economic efficiency.

“The ruling is a clear blow to Mastercard and Visa, though it left open the possibility to reduce their exposure to damages,” said Aitor Ortiz, an analyst at Bloomberg Intelligence.

At issue is the use of so-called interchange fees, levied by banks at rates set by the card companies each time a consumer’s plastic is swiped at a register. The fees are then passed on to the retailers. Mastercard faces at least 10 lawsuits filed by retailers in the U.K. totaling as much as $2 billion in claims, according to Bloomberg Intelligence.

Lawyers for the retailers at Stewarts said the ruling “unequivocally recognized that the fixing of interchange fees by MasterCard and its network members over many years was and is an unlawful infringement of competition law.”

In a statement, Mastercard emphasized that the appeals court ruling isn’t final and the issue will be reviewed by the Competition Appeal Tribunal.

“We continue to firmly believe that retailers derive real value from our network,” the Purchase, New York-based company said in a statement. Visa declined to comment after the ruling.

Visa had been seeking to uphold a 2017 ruling by Judge Stephen Phillips, who said the transactions are legal. But the retailers succeeded in persuading the appeals court to side with a group of specialty antitrust judges at the CAT who in 2016 ruled that Mastercard owed Sainsbury’s 69 million pounds ($91 million).

The tribunal, which will consider at what level the fees could be set if any, should take note that Sainsbury’s accepted at its trial that fee levels of 0.2 percent for debit cards and 0.19 percent for credit cards would be lawful, the judge said.

“The card companies will likely pay damages only for the amount above these levels,” BI’s Ortiz said. The ruling confirms existing European Union “case law as regards to swipe fees and it won’t help Visa and MasterCard in their ongoing antitrust probes.”

The case is Sainsbury’s v Visa Europe, U.K. Court of Appeal, Civil Division, Case No: A3/2017/3493.