Image copyright EPA Image caption Seaborne Freight had its contract for the Ramsgate-to-Ostend route revoked

The government is facing a court challenge over the contracts it awarded to three shipping firms as part of its no-deal Brexit preparations.

Eurotunnel, which operates railway services between the UK and France, says the contracts were handed out in a "secretive" way.

The firm says it was not given the chance to compete and wants the contracts quashed.

The case, which starts on Friday, is expected to conclude next week.

'Extreme urgency'

At the end of December, the Department for Transport (DfT) contracted three suppliers - Brittany Ferries, DFDS and Seaborne Freight - to provide additional freight capacity for lorries at ports other than Dover, in the event that a no-deal Brexit leads to congestion on roads down to the coast.

In documents outlining the agreements, the DfT stated that an "unforeseeable" situation of "extreme urgency" meant there was no time for the contracts to be put out to tender - the standard practice for public procurements.

One firm, Seaborne Freight, has already had its contract cancelled after the Irish company backing the deal pulled out.

Shortly after it was awarded the contract, the BBC found out that Seaborne had no ships and had never run a ferry service.

Transport Secretary Chris Grayling has been heavily criticised for the Seaborne deal, which would have been worth £13.8m.

Ample time

In January, Eurotunnel wrote to Mr Grayling to complain that it had not been considered when the contracts were awarded.

It argues that unlike Seaborne, it has actually run a cross-Channel ferry service (MyFerryLink, which closed in 2015) and should have been approached.

Image copyright BBC Parliament Image caption Transport secretary Chris Grayling has been criticised over how the process has been handled

The company also claims that the government had ample time to conduct a full and open procurement process, and that the Department for Transport could have foreseen a no-deal Brexit well before the end of last year.

Eurotunnel's lawyers will also argue that the DfT has fallen foul of EU public procurement laws.

For its part, the government will argue that it was not aware that Eurotunnel was in a position to get a ferry service up and running in time for Brexit, and that it approached all of the companies which currently operate ferries between the UK and the rest of Europe.

It will also claim it was not seeking extra rail capacity, and in any case, the purpose of the contracts were to divert lorries away from Eurotunnel's base in Dover or Folkestone, and towards other ports.

Compensation payments

Eurotunnel has previously voiced concerns more broadly about the potential impact of a no-deal Brexit on its business.

If the court finds in its favour, all three contracts, including those with Brittany Ferries and DFDS, could be ruled "ineffective".

Andrew Dean, a director at law firm Clifford Chance, and a former government advisor, said that in such a scenario, "a critical part of the country's no-deal Brexit preparations could be swept away just weeks before Brexit Day on 29 March".

He added that "the government could face substantial civil fines and be forced to pay damages to Eurotunnel."

Analysis: Joe Miller, BBC Business reporter

Chris Grayling's Department for Transport first posted notices of its three Brexit ferry contracts onto an EU portal on Christmas Eve, probably in the assumption that they wouldn't attract much attention.

But days later, the awards were headline news, and the DfT was under fire from MPs for handing a contract to Seaborne Freight, which had never sailed a vessel.

While seven ferry operators, and two potential operators were approached (including Seaborne), Eurotunnel was not, and it says its business could be disadvantaged as a result.

The government will have to defend its entire procurement process, and specifically prove three things. First, that there was a need for extra freight capacity at the end of March. Second, that there was indeed no time for a full public tender process. And third that it could not have foreseen the probability of a no-deal Brexit, and had to rush things through when such a scenario became likely.

Legal experts believe proving the last point that will be the biggest challenge for Mr Grayling's lawyers. And if they fail to convince the court of the need for urgency, one of the transport secretary's key Brexit contingency plans could be ripped up less than a month before Britain is scheduled to leave the EU.