In 2006, two years after the investigation had been launched, the Saudis were threatening "repercussions" if the SFO investigation was allowed to proceed.

The SFO investigators were about to fly to Switzerland to gain access to bank accounts controlled by Saudi middleman Wafic Said, into which BAE had paid millions of pounds.

Blair's first attempt to end the investigation failed when Goldsmith stood firm. In a secret memo dated October 3 2006, Jonathan Jones, Goldsmith's chief of staff, told Gus O'Donnell, the cabinet secretary, that the "attorney is of the firm view that, if the case is in fact soundly-based, it would not be right to discontinue it on the basis that the consequences threatened by the Saudi representatives may result".

The Saudis stepped up their campaign to have the investigation stopped. During November, they delivered an ultimatum to Blair, telling him that they would suspend diplomatic ties with Britain unless the investigation ended.

On December 8, Blair wrote a "secret and personal" letter to Goldsmith in extremely strong terms demanding that he stop the investigation.

He said he was concerned about the "critical difficulty" in negotiations over a new Typhoon fighter sales contract, as well as a "real and immediate risk of a collapse in UK/Saudi security, intelligence and diplomatic co-operation."

"I am taking the exceptional step of writing to you myself" he said, because he thought he "would be failing in his duty" otherwise.

Blair said these were "extremely difficult and delicate issues" but he knew that constitutionally "any intervention you make ... must be your decision alone". Politicians normally have no right to interfere in a criminal case.

Goldsmith again attempted to resist. He saw Blair three days later and said, according to the official minute, that "While he was could see the force of the points in the prime minister's minute ... he was concerned that halting the investigation would send a bad message about the credibility of the law in this area, and look like giving in to threats."

Blair told him "higher considerations were at stake". He added: "Proceeding with the case would result in the end of Saudi-UK co-operation". Blair argued that this would endanger Britain's security as the Saudis would cut off the flow of intelligence about al-Qaida terrorists."

The minute of the meeting on December 11 also shows that Goldsmith suggested to Blair as an alternative that: "he felt justified in questioning whether the grounds for the investigation were soundly based and in exploring legal options for resolving the case as quickly as possible."

Within three days, on December 14, Goldsmith rose in the House of Lords to announce that the investigation had been terminated.

In those three days, he had examined the key evidence uncovered by the SFO investigators and claimed that a successful prosecution was unlikely.

The documents also show that the prime minister also personally vetoed a proposal that BAE could plead guilty to more limited corruption charges, saying this would "be unlikely to reduce the offence caused to the Saudi royal family."

more on this story

A man spying on peace campaigners for the arms firm BAE was last night revealed to be closely linked to the Conservative party. Paul Mercer, a friend of shadow defence minister Julian Lewis, was exposed through court action by the Campaign Against the Arms Trade (CAAT).

In 2003, BAE Systems - Europe's largest arms company - was accused of spying on a small group of peace campaigners. Mark Thomas refused to believe that his trusted friend and fellow activist Martin Hogbin could possibly have any involvement in the story. But then the doubts began to set in ...