The government has paid Eurotunnel up to £33m over its controversial no-deal Brexit ferry contracts.
In exchange for the cash, the firm has dropped its legal action brought about the "secretive" process used around the shipping deals, aimed at ensuring critical supplies if Britain left the EU without agreement on 29 March.
The Channel Tunnel operator had challenged the Department for Transport's decision to award contracts worth £108m to three ferry companies at the High Court.
One of the firms was Seaborne Freight, which sparked a storm of criticism as it did not have any ships .
The deal was subsequently scrapped by the government last month after its financial backer Arklow Shipping pulled out.
The huge taxpayer-funded payout will ramp up further pressure on embattled Transport Secretary Chris Grayling, who has been at the centre of a string of controversies, and fuel calls for him to be sacked.
Labour has branded his record "one of serial failure and routine incompetence", arguing his "trail of destruction has gone on long enough".
The debacle will also be seized on by opponents of Brexit.
Downing Street has said Theresa May still had full confidence in Mr Grayling.
It also insisted the settlement was "absolutely not" an attempt to keep details of the contentious saga out of the public domain.
Under the agreement the money will be used by Eurotunnel to help improve security and traffic flow at its UK terminal.
The government said this would "ensure the Channel Tunnel is ready to continue to keep passengers and freight moving post-Brexit".
It also pointed out it would protect the "vital freight capacity" purchased from ferry operators to help ensure the continued supply of "crucial medicines, medical supplies and veterinary medicines in a no-deal scenario".
A government statement said the "primary reason" for reaching an out-of-court agreement with Eurotunnel was to ensure "vital goods would not be put in jeopardy".
It added: "A lengthy legal case and the uncertainty it creates is not in anyone's interest."
Mr Grayling, 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."
Labour's 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."
Eurotunnel said in a statement: "Eurotunnel has concluded an out of court agreement ... that will ensure the Channel Tunnel remains the preferred route for vital goods to travel between the EU and the UK.
"The agreement enables the development of infrastructure, security and border measures that will guarantee the flow of vehicles carrying urgent and vital goods, thereby keeping supply chains essential to both industry and consumers moving."