Germany had managed to obtain accurate predictions of the route Churchill was likely to take on a flight home from Egypt via Algiers and Gibraltar.
The plot was foiled by staff at the Bletchley Park code and cypher school who intercepted messages from Tangier to Berlin.
Clement Attlee, Deputy Prime Minister, warned Churchill in a telegram: 'Attempts are going to be made to bump you off.
'We have studied possibilities very carefully and I and my colleagues, supported by the chiefs of staff, consider that it would be unwise for you to adhere to your present programme. We regard it as essential in the national interest that you cut out visits to both Algiers and Gibraltar and proceed to England, stopping only at Marrakesh.'
The head of the Secret Intelligence Service, Major-General Sir Stuart Menzies, known as 'C', named Hans Peter Schulze, head of German intelligence in Tangier, as the man behind the plot. Early in 1943, Schulze signalled to Berlin: 'Please dispatch urgently 20-50 machine pistols with ammunition, magnetic and adhesive mines. Also poisons for drinks and effective upon physical contact.'
A second message reported that Schulze and three others had set off for Algiers 'with an assignment against Churchill'.
The files confirm that 'at least four saboteurs with necessary material' crossed the frontier on 4 February, but reveal no further details. Churchill clearly heeded Attlee's warning and changed his flight plan.