The unpublished papers, some written in a cryptic shorthand cracked by off-duty cryptanalysts at GCHQ, were given to the University of Cambridge’s Churchill Archives Centre.

They were bequeathed as part of Lord Hailsham’s will following his death in 2001. During a long and distinguished political career, Hailsham twice held the post of Lord Chancellor under the leadership of Margaret Thatcher and Ted Heath.

Perhaps the most astonishing revelation in his diaries is of a massive security breach in April 1964 - which nearly resulted in the kidnap of Prime Minister Alec Douglas-Home.

Unguarded overnight at Potterton House, near Aberdeen, Home found himself alone with the kidnappers - but coolly talked them into abandoning the plot.

Characteristically, he agreed to suppress the story to save the career of his bodyguard and it remained unpublished to this point.

The source is Home himself. Hailsham’s diary entry for January 9, 1977, notes how Home related the tale to him and other members of a shooting party at Birkhill, a country house near Cupar in Fife.

It reads: “An odd story of the 1964 election never published. Alec (then Prime Minister) was staying with John and Priscilla Tweedsmuir - who had no room for Alec’s private bodyguard. He went to the nearest town (Aberdeen?) and John & Priscilla left Alec for a time alone in the house. Knock at the door. Door answered by PM in person. Deputation of left-wing students from Aberdeen University. Said they were going to kidnap Alec. He: “I suppose you realise if you do the Conservatives will win the election by 200 or 300.” He asked and received permission to pack a few things & was given 10 mins grace. After that they were offered and accepted beer. John & Priscilla returned and the kidnap project abandoned. The bodyguard swore Alec to secrecy as his job would have been in peril.”

Chris Collins of the Margaret Thatcher Foundation, who worked with Cambridge University to digitise Hailsham’s papers, said although it ended well, the Home kidnap plot had the potential to snowball out of control.

“The Home kidnap prank was one of the worst breaches of a Prime Minister’s personal security in the twentieth century,” he said.

“If Home’s assailants had been darker in purpose he could have died that night. Had they succeeded in stopping his car - which they had earlier planned to do - it is likely blood would have been shed; if not his, then certainly theirs.”

As it was, the students from Aberdeen University merely intended to take Home to a house in the city for a few hours then release him.

According to reports, Home posed for photographs with his would-be kidnappers (which were never published) and remarked how being kidnapped would allow him to avoid work on the following Monday.

Many of the more sensitive entries in the never-before-seen diaries and correspondence contain a coded version of ‘speedwriting’ - a form of shorthand developed in the 1920s.

To help crack Lord Hailsham’s code, the Churchill Archives Centre enlisted the help of GCHQ, the Government’s secret intelligence agency.

Members of their Kryptos Society – codebreakers on their lunch break – worked on the political diaries to help decipher the material.

Hailsham’s papers, which include political diaries from 1970-79, wartime diaries from 1941-2 and correspondence with MPs and Peers from 1938-77, took Churchill’s Sophie Bridges three and a half years to sort, catalogue and decode.

Hundreds of pages can be read at www.margaretthatcher.org. The website is also setting would-be cryptanalysts a Hailsham Challenge - where visitors can attempt to crack some of the untranslated code.