Newly released files have exposed the role Margaret Thatcher personally played in securing one of the UK’s biggest and most controversial arms deals.

The previously secret files show how officials helped then Prime Minister Mrs Thatcher carefully negotiate the notorious Al-Yamamah deal which saw Britain sell fighter jets to Saudi Arabia.

The documents detail a meeting and private lunch between Mrs Thatcher and King Fahd, soon after which the £42bn contract was clinched, sparking anger form arms-trade campaigners.

It came back to haunt Tony Blair who intervened to stop an investigation into the deal, that was exploring claims of ran a multimillion-pound "slush fund".

The files released by the National Archives at Kew reveal the delicate tightrope Mrs Thatcher walked to initially secure the contract and the efforts to keep talks secret.

She was invited by Prince Bandar to meet King Fahd in Riyadh, a trip supported by then Defence Secretary Michael Heseltine on the proviso there was certainty it would clinch a deal to sell the Tornado jets.

Mr Heseltine’s private secretary, Richard Mottram, wrote to Mrs Thatcher's adviser Charles Powell: "It seems unlikely that Prince Bandar would seek to engineer such a meeting unless something positive was likely to come out of it, otherwise he runs the obvious risk of embarrassing both the Prime Minister and King Fahd."

A briefing document from the Foreign Office to Downing Street suggested a deal was likely to be the true intention of the visit, but confirmation was needed.

It said: "To date, we only have Prince Bandar’s word for it that the King has decided to buy Tornado. We need to get this made more precise and more explicit.

"Tackling the King in person is probably the only way of smoking the Saudis out."

The Government tried to keep discussions secret from the press, briefing that the Prime Minister would "take opportunities as they arise to promote major export projects".

But, behind the scenes, a detailed strategy was being planned with a confidential document ahead of the meeting outlining "tactical arguments" to secure an "early and favourable decision to purchase”.

Another briefing note urged caution over how Mrs Thatcher would bring up discussions.

It said: "I have no doubt that the Prime Minister will wish to discover the position on Tornado when she sees the King, but I feel bound to advise that she should aim to give the King himself the opportunity to raise the matter first, and that it would not be in our interests to appear to pressure the Saudis unduly at this point."

An official record of the meeting between Mrs Thatcher and King Fahd on 14 April 1985 made no mention of Tornados or an arms deal.

But in a letter to the King the following day, the Prime Minister mysteriously wrote: "I was glad that we were able to discuss a further matter privately over lunch.

"I look forward to receiving your majesty’s personal envoy soon, in order that we may conclude this matter successfully."

That September an agreement in principle was signed for the UK to supply Tornado, Hawk and PC9 aircraft to Saudi Arabia.

The Kingdom had been leaning towards a deal with France, until Mrs Thatcher’s intervention.

But there were later claims that defence giant BAE Systems, making the planes, ran a multimillion-pound "slush fund" offering sweeteners to Saudi royals.

A 1992 report by the National Audit Office into the deal was suppressed over fears it may offend the Saudis, an unprecedented step, and more than a decade later the Serious Fraud Office launched an investigation.