LONDON (AP) — The British government said Wednesday it was scrapping Brexit-related contracts with ferry companies at a cost to taxpayers of tens of millions of pounds (dollars) after the ferry deals sparked a political and legal firestorm.

“Freight capacity contracts for the summer period are no longer needed and have therefore been terminated,” the Department for Transport said.

The ferries were part of the government’s planning for a “no-deal” Brexit in case Britain leaves the European Union without an agreement on divorce terms and future ties.

That could cause gridlock at ports by ripping up the trade rulebook and imposing tariffs, customs checks and other barriers between the U.K. and the EU, its biggest trading partner.

But the contracts came under fire earlier this year when it emerged that one firm involved had no ships and no experience running a ferry service.

Transport Secretary Chris Grayling defended the contracts, saying they had been a prudent “insurance policy.”

The department said Wednesday that the cost of canceling the deals is a bit lower than an estimate given by auditors, 56 million pounds ($73 million).

The government also had to pay 33 million pounds ($43 million) to settle a lawsuit from cross-channel rail operator Eurotunnel, which alleged that it had been improperly excluded from bidding for post-Brexit freight contracts.

The government is now being sued by P&O Ferries, which claims the payout to Eurotunnel puts it at a competitive disadvantage.

The government put no-deal planning on hold after Britain’s departure was postponed from its originally scheduled date of March 29 until Oct. 31 amid political gridlock in Britain over withdrawal.

Prime Minister Theresa May struck a divorce deal with the EU late last year, but Britain’s Parliament has rejected it three times. May has failed to persuade many Brexit-backing lawmakers from her own Conservative Party to support an agreement that they think keeps Britain too tightly bound to the bloc’s rules.

The government has held several weeks of talks with the opposition Labour Party about striking a compromise, but the meetings have not produced a breakthrough.

May’s Downing Street office said Wednesday that ministers and civil servants would continue “to take whatever decisions are required to make sure we are prepared in the event of a no-deal scenario.”