Leaked documents show top tax official shook hands last year on secret settlement described by sources as a 'cock-up'

Britain's tax authorities have given Goldman Sachs an unusual and generous Christmas present, leaked documents reveal. In a secret London meeting last December with the head of Revenue, the wealthy Wall Street banking firm was forgiven £10m interest on a failed tax avoidance scheme.

HM Revenue and Customs sources admit privately that the interest-free deal is "a cock-up" by officials, but refuse to say who was responsible.

Documents leaked to Private Eye magazine and published in full by the Guardian record that Britain's top tax official, HMRC's permanent secretary Dave Hartnett, personally shook hands on a secret settlement last December.

Hartnett is due to be questioned on Wednesday by the Commons public accounts committee. The leaked documents suggest that a previous PAC chairman, Edward Leigh, was misled when he was told it was illegal to reveal details of such cases to parliament.

Leaked legal advice from James Eadie QC, which the Guardian also publishes today, says the opposite. Hartnett has discretion to reveal such facts to the parliamentary watchdog, according to the advice.

Leigh said: "It just underlines the absurd culture of secrecy that still pervades Whitehall."

Hartnett also refused to give the facts about Goldman Sachs to MP Jesse Norman on the Treasury committee last month, claiming disclosure would be illegal. He also refuses to brief ministers on the details.

The £10m Christmas gift for Goldman was the culmination of a prolonged attempt by the US firm to avoid paying national insurance on huge bonuses for its bankers working in London.

The sum was pocket change to Goldman, whose employees received $15.3bn (£9.5bn) in pay and bonuses last year. Its Wall Street head, Lloyd Blankfein, received $68m in 2008 and at the height of Britain's banking crisis 100 London partners set their bonuses at £1m each. This level was considered a mark of restraint.

In the 1990s, Goldman set up a company offshore in the British Virgin Islands. This entity, called Goldman Sachs Services Ltd, supposedly employed all of Goldman's London bankers, who were then "seconded" to work there.

The device appears to have been designed to conceal the size of the bonuses. Judge David Williams said in 2009 that it was "a way of keeping information about the GS accounts and payroll out of the public domain and confidential".

Goldman also begrudged paying its share of UK national insurance on the six-figure bonuses. Court judgments disclose that a typical Goldman bonus to a junior banker was £143,000 in 1998, and £191,000 the following year.

The company, along with 21 investment banks and other firms, purchased blueprints for an avoidance scheme called an employee benefit trust (EBT). The bonuses were indirectly invested into elaborate share option schemes.

It took the Revenue until 2005 to demonstrate in court that these EBTs were merely illegitimate tax avoidance devices. The 21 other firms surrendered, and handed over what they owed.

But Goldman Sachs refused to pay its £30.81m bill. Instead the city firm Freshfields and the tax QC David Goldberg fought tooth and nail on Goldman's behalf through the courts. By 2010, according to a public judgment, the unpaid bill with accumulated interest had mounted to £40m.

According to Revenue lawyers, in the leaked documents, Goldman's tactics were highly obstructive: they "resisted for five more years, raking up every conceivable point in the tribunal, and putting up a 'stooge' witness when Mr Housden [Goldman's tax director] was the obvious person to answer questions".

In April 2010, the bankers lost a key point: a judge threw out the claim that their true employer was in the British Virgin Islands. In July, HMRC's own QC, Malcolm Gammie, gave "broadly positive" advice that the government was in a strong position to get all of its money.

But on 30 November, a high-level HMRC committee handling the most aggressive banks heard troubling news. Their top expert, Hartnett, had met Goldman's tax director, Mike Housden, and as a result "a late submission had come in about a deal on which Dave Hartnett had 'shaken hands' with Goldman Sachs". The government was not going to get its full £40m, but only £30m.

HMRC's lawyers were dismayed. At a meeting a week later, on 8 October, chaired by general counsel Anthony Inglese, "he said he would always want to assist Dave Hartnett, but not if this were 'unconscionable'. He referred to the difficulty all those present at this meeting were having in justifying a settlement without an interest element."

The minutes added: "It was … clear that the proposed settlement gave GS no additional penalty for having resisted for five more years."

At a Treasury committee hearing last month, Hartnett refused to explain any of this to Jesse Norman, a Conservative MP. Hartnett claimed that it would be illegal to reveal any information about the Goldman deal. In fact, according to the leaked documents, HMRC has already received legal advice that says otherwise.

Treasury counsel James Eadie QC advised the HMRC board in 2009 that Hartnett was free to disclose information to parliamentary committees, at his own discretion.

Privately, HMRC sources say that £10m of taxpayers' money was thrown away because of a "technical mistake" by an unidentified official, junior to Hartnett, who misinterpreted the law. They claim that the National Audit Office, which audits HMRC accounts, has accepted the situation.

HMRC said in a statement: "The picture you have been given is incomplete and therefore fundamentally flawed but taxpayer confidentiality prevents us from correcting your story in detail. Dave Hartnett's long career in the tax service has been built on ensuring the right tax is paid by large businesses and individuals alike. HMRC does not do 'sweetheart' deals." Goldman Sachs declined to comment.