Image copyright PA Image caption Bernie Ecclestone has been at the helm of Formula 1 for almost 40 years

Formula 1 boss Bernie Ecclestone has avoided a potential £1.2bn tax bill as a result of a secret deal with HMRC.

The deal involved a payment of just £10m, according to legal transcripts obtained by BBC Panorama.

Revenue & Customs spent nine years investigating the Ecclestone family's tax affairs before offering to settle in return for the payment from the family trusts in 2008.

Mr Ecclestone said he paid more than £50m in tax last year.

Mr Ecclestone, the chief executive of Formula 1, is currently on trial in Germany facing corruption charges. It is alleged he was behind a £26m bribe paid to a bank official.

Prosecutors allege the bribe was paid to ensure that Mr Ecclestone retained control of the sport.

Ecclestone admits paying former banker, Gerhard Gribkowsky, but says he was effectively the victim of blackmail as he was worried the banker would tell the tax authorities he had set up an offshore family trust.

Image copyright AFP Image caption The bribery trial of Bernie Ecclestone, seen here with his lawyers, began in Munich last week

Panorama's investigation goes back to 1995 when Mr Ecclestone secured ownership of the lucrative TV rights of Formula 1.

Shortly afterwards he moved this prize asset offshore, giving the rights to his then wife, Slavica.

She transferred them to a family trust in Liechtenstein, before selling them for a huge profit, free of UK tax.

It may be the biggest individual tax dodge in British history, and is legally watertight provided Mr Ecclestone did not set up, or control, the trust.

If he had done, Mr Ecclestone has admitted, he could have faced a tax bill of more than $2bn - or £1.2bn.

Barrister and tax expert Jolyon Maugham said this was a "pretty substantial" loss of tax.

"I'm certainly not aware of anything else remotely approaching that sort of magnitude, in my fairly extensive experience."

Panorama: Find out more Image copyright bbc Darragh MacIntyre presents Panorama - Bernie Ecclestone: Lies, Bribes and Formula One

BBC One, Monday 28 April at 20:30 BST Then available in the UK on the BBC iPlayer

HMRC deal

UK tax authorities spent nine years investigating the Ecclestones' tax affairs before agreeing a settlement.

HMRC does not comment on individual cases, but Panorama has obtained evidence from the previously unpublished transcripts of interviews conducted by a German public prosecutor.

One of the lawyers who helped run the Ecclestone family trusts, Frederique Flournoy, told the prosecutor: "In summer 2008, the Inland Revenue offered to conclude the matter if we paid £10m. We decided to pay up."

According to Ms Flournoy's evidence, the Ecclestone family trusts earn around £10m in interest every six weeks.

Labour MP Emily Thornberry, the shadow attorney general, said: "Ten million may sound like a lot to some people but you have to look at it in the round.

"And if we're talking about a trust fund in which they are making huge amounts of money like this, then it isn't very much is it?"

Image copyright PA Image caption Mr Ecclestone and ex-wife Slavica had two daughters - Petra and Tamara - before their divorce in 2009

Mr Ecclestone says he gave away his fortune to avoid inheritance tax laws that he considered to be "very unfair" at that time.

Having gifted the assets to his wife, Mr Ecclestone can't receive payments from his family's offshore trusts.

But Ms Flournoy told the German prosecutor he's been receiving payments from his wife since his divorce: "Mrs Ecclestone received disbursements from the Trusts. In other words, she also has a personal asset. That is also the basis on which the divorce ruling fixed the payment amounts to Ecclestone."

When asked how high the divorce payments were to Mr Ecclestone, she said: "I don't know the exact figure, however it must be around $100 million a year."

'More transparent'

Mr Ecclestone said his divorce was a "private matter". He says he has always paid his fair share of tax and that he is "proud to be British and proud to make my contribution by paying my taxes here."

Slavica Ecclestone's lawyer said her estate planning was based on legal advice and that she was entitled to privacy in her tax affairs.

A lawyer for the family trusts said Mr Ecclestone has not exerted any control over the management of the trusts. He said the transcripts from the German prosecutor contained errors.

A spokesperson for HMRC said: "The way in which HMRC settles and assures tax disputes has been completely overhauled in recent years, making the process more transparent.

"The effectiveness and propriety of such settlements is overseen by a Tax Assurance Commissioner, who publishes an annual report covering all large settlement cases."