Ryanair has won a court battle against UK government rules under which airlines are fined for failing to prevent illegal immigrants flying to Britain.

The Times reported that the budget carrier paid £400,000 in one year alone after failing to spot forged identity documents or out of date visas.

Ryanair challenged one fine of £4,000 after its staff failed to spot forged Greek passports being carried by two Albanians travelling from Majorca to Edinburgh.

The airline said the £400,000 figure related to 200 cases in 2015 in which passengers travelled with forged passports or invalid visas.

Giving his verdict, Judge Damien Lochrane said the way the Home Office regime was operated “offends fairly basic concepts of justice and indeed the rule of law”.

The judge said airlines could not be reasonably expected to spot forged documents that are so similar to genuine ones that trained immigration officials often can’t tell the difference.

Judge Lochrane accused the government of effectively devolving part of its border control duty onto private airlines and said the rules had been applied inconsistently.

“One must remind oneself that it is not the duty of carriers to permit entry or exit. That duty lies with the Border Force,” he said.

The Times said last month’s ruling, although it is not binding on other courts, puts the Home Office’s scheme into disarray.

Under the immigration laws passed in 1999 aircraft and ship owners can be charged £2,000 for any passenger who arrives at passport control without the correct documents.

A Home Office spokesman told The Times: “Airlines must be satisfied that all passengers have the necessary documentation before they are allowed to board a flight to the UK.

“We work closely with airlines to make sure their knowledge of documentation is thorough and up to date and carry out training with airline handling agents both in the UK and overseas.”