Eurotunnel has dropped its legal claim against the government over “secretive” post-Brexit ferry contracts after ministers agreed to pay out £33m to the firm.

Chris Grayling’s department ended up in hot water after it handed out lucrative contracts to increase cross-Channel capacity in the event of a no-deal Brexit to three firms – including one company that did not have any ships.

Eurotunnel, which operates the Channel Tunnel, mounted a legal challenge against the government over the move, saying the £108m contracts had been doled out in a “distortionary and anti-competitive” way.

The government announced on Friday it had reached an agreement with Eurotunnel, where the firm has committed to improving access, security and traffic flow in its UK terminal.

It said in a statement: “As part of the agreement, Eurotunnel has also withdrawn its legal claim against the government, protecting the vital freight capacity that the government has purchased from DFDS and Brittany Ferries.

“This freight capacity will help ensure the continued supply in a no-deal scenario of crucial medicines, medical supplies and veterinary medicines.”

The latest twist in the ferry contracts fiasco places renewed pressure on Mr Grayling, who has come under sustained criticism since it emerged that Seaborne Freight, one of the firms, did not have any ships and had apparently copied its online terms and conditions from a takeaway restaurant.

He was then forced to scrap the £13.8m contract with Seaborne last month after its main backer, Irish firm Arklow Shipping, withdrew its support.

In a statement, the transport secretary said: “The agreement with Eurotunnel secures the government’s additional freight capacity, helping ensure that the NHS has essential medicines in the event of a no-deal Brexit.

“While it is disappointing that Eurotunnel chose to take legal action on contracts in place to ensure the smooth supply of vital medicines, I am pleased that this agreement will ensure the Channel Tunnel is ready for a post-Brexit world.”

Grayling's biggest failings Show all 8 1 /8 Grayling's biggest failings Grayling's biggest failings Banning books for prisoners Then Justice Secretary Grayling introduced a ban on sending books to prisoners in November 2013. The ban was later deemed unlawful by the High Court PA Grayling's biggest failings Knocking a cyclist off their bike Transport Secretary Chris Grayling knocked a cyclist off their bike by opening his car door in 2016. The footage was released by the recording cyclist a few months after the incident when Grayling complained about London's cycle lanes Guardian Grayling's biggest failings Train timetables fiasco After an Office for Road and Rail report found that nobody had taken charge during a major change to train timetables that left more than one in ten trains being late or cancelled on Northern and Thameslink, Transport Secretary Grayling insisted he was not to blame PA Grayling's biggest failings Unlawful cuts to legal aid The cuts to legal aid for certain categories of prisoner that Grayling introduced as Justice secretary in 2013 were found to be unlawful by the High Court PA Grayling's biggest failings Private probation reversal Theresa May's government has opted to renationalise the supervision of former prisoners after a part-privatisation program begun by Grayling in 2014 was found to be putting the public at risk PA Grayling's biggest failings Ferry contract for a company with no ferries Grayling handed a £14 contract to Seaborne Freight to deliver goods from Ostend to Ramsgate in the event of a no deal Brexit. The contract fell through after the Irish company that Seaborne was relying on to carry out the shipping pulled out PA Grayling's biggest failings Criminal courts charge In 2015, then Justice Secretary Grayling introduced a policy whereby convicted criminals would have to pay from £150-£1200 towards the cost of their case. The policy was criticised for compelling defendants to plead guilty and led to protests by magistrates. The policy was scrapped by Michael Gove when he became Justice Secretary later that year PA Grayling's biggest failings Cyclists not road users As Transport Secretary, Grayling once failed to recognise cyclists as road users PA

Labour called for him to resign over the “trail of destruction” he had caused in various government departments, including the part privatisation of the probation service, which has cost the taxpayer an extra £427m.

Shadow transport secretary Andy McDonald said: “On the same day a National Audit Office report highlights that disastrous decisions by Chris Grayling at the Ministry of Justice have wasted nearly half a billion pounds of public money we also learn that the transport secretary’s misjudgement over the award of a ferry contract has left taxpayer’s liable for £33m in compensation to Eurotunnel.

“This follows a damning Public Accounts Committee report on Wednesday on his mismanagement of the railways.

“His conduct as a minister is one of serial failure and routine incompetence. In any other sphere of life he would have been sacked long ago. I say yet again: this trail of destruction has gone on long enough. It’s time for Chris Grayling to go.”

Pro-EU Labour MP Wes Streeting said it was clear that Brexit had become a “colossal waste of time and money”.

He said: “Another £33m of taxpayers’ money is now being thrown away thanks to the shambolic mismanagement of leading Brexiteer Chris Grayling and his inexplicable, secretive decision to hand a lucrative contract to a ferry company with no ferries.

Support free-thinking journalism and attend Independent events

“The amount of money already wasted on Brexit won’t be recovered, meaning less money for vital areas like the NHS, education and defence. This debate is no longer about wild claims, theories or predictions and now that there are new facts about the real cost of Brexit, there should be a new vote that gives people a real say.”

A Eurotunnel spokesman said: “Eurotunnel has concluded an out-of-court agreement with the secretary of state for transport, that will ensure that the Channel Tunnel remains the preferred route for vital goods to travel between the EU and the UK.