The Royal Bank of Scotland could face a bill running into millions of pounds over its refusal to pay out successful PPI mis-selling claims to people who have been insolvent.

In a long-awaited ruling at the Court of Session, judges threw out an appeal by RBS against an earlier ruling which could help thousands of people who have been refused payouts.

After a five-year battle, the bank has been told it must pay refunds and interest on payments even in respect of customers who previously owed the bank money, but whose debts have been discharged.

Industry sources say lawyers specialising in financial claims have thousands of similar cases on their books awaiting the court’s ruling. One insider said: “I know of three firms who just between them have people on their files who are due £10m for claims which have already been upheld.”

When all claims are taken into account, RBS could be forced to distribute hundreds of millions of pounds in pay-outs it had hoped to avoid, he said.

The case heard at the Court of Session relates to a Mrs Alison Donnelly, who borrowed money from RBS between 1997 and 2003. She was also sold payment protection insurance.

In 2006 Mrs Donnelly became insolvent and signed a trust deed appointing a trustee to resolve her estate and use assets to pay off her debts. Creditors, including the RBS received payments, but only around a fifth of what they were due.

Under the terms of the 1985 Bankruptcy Act, once this was done, with her estate distributed and the trustee paid for their role, Mrs Donnelly’s debts were legally discharged in full.

However when she subsequently put in a successful claim – along with millions of others – over having been mis-sold PPI, the bank refused to pay.

Having agreed to settle her claim for £11,927, RBS sent her just one instalment of £1,111.63, then argued that it was entitled to offset the award against more than £21,000 which it claimed she still owed the bank as a result of the loans.

Mrs Donnelly disagreed, and at the court of session the Lord Justice Clerk Lady Dorrian, Lord Menzies and Lord Glennie backed the view of her lawyers that the debt no longer existed in law.

Many people, including those affected by the financial crisis of 2007/8, signed trust deeds with about 8000 being agreed annually until the figure began to dip in recent years. Many have received similar letters from RBS to those sent to Mrs Donnelly refusing payments and citing debts not fully repaid under trust deeds. RBS, and to a lesser extent Capital One are the only banks thought to have taken this stance.

In his opinion, Lord Glennie rejected the arguments of the RBS lawyers, in what he said was an ‘important and novel point of law’ regarding insolvency.

He said it was not disputed that the bank could no longer pursue Mrs Donnelly for the loans she had defaulted on as the termination of a trust deed discharged those debt in full. The case hinged on whether the bank could use what was unpaid as a ‘shield’ against claims such as the PPI repayment.

However this argument would undermine the clarity of insolvency proceedings, Lord Glennie said. “If at the moment the trust deed terminated the debtor was not fully discharged from all his debts due to his creditors, in the sense of his liability for those debts being extinguished, that would leave him in a state of uncertainty.”

Meanwhile the ruling would disadvantage other creditors, potentially allowing the bank to await the fair distribution of assets from an insolvent person’s estate then later ‘off-set’ a payment against the previous debt, essentially undermining the fair distribution achieved by a trustee.

“It is not difficult to envisage cases where the amount of the difference is significant” Lord Glennie wrote.

Finally, the suggestion by the RBS lawyers that a further payment to balance out the benefits to other creditors could be made was likely to be “virtually unworkable” and would amount to effectively reopening the trust deed.

In conclusion, he said: “The debt in the present case was discharged or extinguished by agreement when the trust deed was terminated.

“Thereafter the bank no longer had a debt owing to it which it could use to set off against Mrs Donnelly’s claim.”

The court dismissed comparisons with a previous case Dooneen Ltd v Mond, which lawyer for RBS David Sellar QC claimed was undistinguishable from Mrs Donnelly’s situation. However the court disagreed.

Lord Glennie’s ruling noted that RBS may yet decide to attempt to reopen Mrs Donnelly’s trust deed in a bid to get around the decision.

However Mark Carlin, of Friels Solicitors who acted for Mrs Donnelly, said this was unlikely to succeed.

“I don’t see that it has any prospect of success whatsoever,” he said. “For the RBS there is a lot of money involved in this and a lot of people are affected from what we can gather.

“ But this has been going on for five years and this ruling brings it to an end.”

Citizen’s Advice Scotland said it had been monitoring RBS’s approach to such claims and that the ruling was significant

Myles Fitt, Financial Health spokesperson for the charity, said: “Now that this long awaited decision has been made we think the RBS should not delay or force consumers to make their own legal claims to get back funds that they were due all along.

“The RBS should do the right thing and refund anybody affected as soon as possible.”

RBS is understood to be considering appealing to the supreme Court. A spokesman said: “The bank notes the Court of Session’s ruling and is currently considering its options in terms of next steps.”

In June the bank confirmed it has already set aside £5.3bn in total to compensate victims of mis-selling, £4.9 bn of which has already been paid out, and it and other banks are also facing a spike in claims made by customers in the run up to the August 29th deadline for making PPI claims.