Scotland's legal aid fund has escaped a bill for hundreds of thousands of pounds after a dispute with the Home Office on legal costs in a landmark asylum case.

The Scottish Legal Aid Board (Slab) could have ended up paying for scores of costly asylum appeals had the decision in the case - which went all the way to the UK's highest court, the Supreme Court - gone the other way.

The proceedings centred on two asylum seekers based in Scotland who successfully appealed against a decision to remove them from the country.

Home Office officials tried to overturn that ruling and lost, before trying to avoid paying the costs involved - estimated to run to six figures - and losing again.

A spokesman for Slab welcomed the court's decision, claiming the recovered expenses will help it continue ensuring access to justice.

He said: "We are pleased that in this case the court has decided the cost of the case should not be borne by the legal aid fund.

"The recovery of expenses in cases like this helps the Scottish Legal Aid Board to manage spending from the legal aid fund so it can help as many people as ­possible solve their legal problems and secure access to justice as has happened in this case."

Lawyers had warned that had the Home Office been successful in the expenses dispute, it could have had a major knock-on effect.

Peter Farrell, who represented one of the asylum applicants, claimed the costs to Slab would have been significant and may have led to reduced funding in asylum cases.

Following the recent decision, he said: "The way legal aid works is we recover the expenses then we pay them to Slab. The board budget very carefully what their expenditure will be and they will have factored in monies they will recover from successful appeals.

"The expenses in this case include fees from the Court of Session and the Supreme Court -that means senior counsel, junior counsel, Edinburgh agents, as well as solicitors. It is a lot.

"The usual rule in law is expenses follow success and this decision demonstrates that the Home Office should not be exempt from the normal rule in litigation that if you lose you pay the other side's expenses."

As reported in The Herald earlier this year, the two applicants successfully appealed against a decision of the Upper Immigration Tribunal, which found against them based on the evidence of a controversial language checking system.

They won their appeal at the Court of Session, where a judge found serious fault with the use of linguistic reports compiled by Swedish firm Sprakab, which analyses the language and dialect of asylum applicants.

The Home office appealed against that decision at the supreme Court, but a panel of five senior judges agreed with the findings of the Scottish court.

The ruling - which found the reports went well beyond their remit and were too heavily relied on in immigration cases - was welcomed by lawyers and campaigners.

One of the applicants in the case has been granted asylum after the main judgment, while the other is awaiting a fresh immigration hearing. A Home Office spokesman declined to comment on the expenses issue.