A new authorised history of MI5 throws light on the dealings of the secret service.
MI5's task is described in its motto, Regnum Defende - Latin for defence of the realm.
It is a phrase which is deceptively simple, but the true meaning of which has often sparked deep controversy and suspicion.
It is also a title borrowed for the first authorised history of MI5, The Defence of the Realm: The Spooks and the Politicians, which uses the organisation's own secret records to tell its story from 1909 to the present day.
When it was created in 1909, MI5's function was simple - catching German spies in Britain.
World War II marked a high point, with MI5 taking the lead in the legendary "double cross" - turning incoming German spies to supply false information back to their controllers.
In the early Cold War, catching Soviet spies became a particularly painful task once it became clear that members of MI5, and its foreign intelligence counterpart MI6, were among those who had been handing over secrets.
It was during the Cold War that MI5's work became entangled more closely with politics, as it focused on countering "subversion" - those attempting "to undermine or overthrow parliamentary democracy by political, industrial or violent means."
This definition left plenty of room for debate over who MI5 should be watching and led to some difficult conversations, especially since any warrant for a phone tap had to be approved by the home secretary.
Politicians themselves were not immune from being watched for communist influence.
The book opens the door to MI5
Whenever a new prime minister assumes office, they are discreetly handed a dossier before deciding who to appoint as ministers.
Inside are details of those MPs about whom MI5 has security concerns.
In the first Wilson government, three Labour MPs are said by the book to have been working for Soviet bloc intelligence agencies.
According to the authorised history, it was politicians who often pushed MI5 to become more engaged in political and industrial disputes. In most - but not all - cases, MI5 resisted.
A number of incidents revealing the interactions between the spies and the politicians are documented including:
• In 1961, Labour party leader Hugh Gaitskell had a list of his own MPs suspected of being communists handed over to MI5. It declined to be drawn into what was seen as party political activity.
• When Henry Brooke became home secretary, he generated considerable anxiety by asking MI5 for a list of all those individuals living in his Hampstead constituency whose mail or phones were being intercepted.
• A file was opened on Harold Wilson in the mid-1940s but was kept under a pseudonym.
• In early 1965, Wilson asked how many MPs were having their phones tapped. The answer was three Labour MPs and one Conservative.
MI5 was only supposed to spy on those engaged in subversion, but some of the most controversial aspects of MI5's interaction with politicians came over industrial disputes and the question of whether MI5 should be providing intelligence to the government on union activities.
Arthur Scargill came under suspicion
In 1966, a National Union of Seamen's (NUS) strike was initially seen as a straightforward industrial dispute, but then NUS militants were overheard at the Communist Party headquarters asking for advice.
As a result, MI5 officers went to see the prime minister, Harold Wilson, and began providing regular reports, briefing him once or twice a day.
Both the main political parties pressed for MI5's help in dealing with industrial unrest.
Edward Heath and his home secretary pressed for eavesdropping of the Electricity Council, but were told it could not properly be considered subversive.
"The home secretary wondered whether our view of what was subversive needed bringing up to date," recorded MI5's number two at the time.
We'd inherited a position where our predecessors had been slightly less intellectually rigorous about this than we were
Meanwhile, union activist Arthur Scargill first had his phone tapped in the 1973 miners' dispute.
Under Jim Callaghan, a group was established in Whitehall to look into subversion in public life, which was provided information by MI5.
There was concern within MI5 that the definition of subversion was being confused with opposition to the government.
John Jones, the deputy director general in 1977, wrote that ministers and senior officials had a "natural tendency" which the service must continue to resist "to equate subversion with (any) activity which threatens a government's policies or may threaten its very existence".
Under Margaret Thatcher, the net was cast even more widely in the hunt for subversion.
She demanded action to deal with "wreckers" in British industry.
A cabinet office unit was established to prevent industrial disruption to which MI5 provided support.
Stella Rimington says many files were destroyed
The former head of MI5, Dame Stella Rimington, said there was much debate then about what a subversive was and whether files should be kept.
She said: "We'd inherited a position where our predecessors had been slightly less intellectually rigorous about this than we were.
"We took the responsibilities of the service very seriously.
"We reviewed many of those files created by our predecessors and destroyed them.
MI5 obtained a copy of the minutes of union leader Derek Robinson at a Communist Party meeting during the Leyland strike.
Margaret Thatcher and Home Secretary Willie Whitelaw agreed an MI5 officer could pass these to British Leyland's chairman in a brown paper envelope and they eventually found their way to the Sunday Times.
During the miners' strike, Mrs Thatcher was passed detailed information about union strategy based on warrants to watch specified subversives, and devoured MI5's Box 500 reports.
Looking back now, some former senior MI5 officials believe too many files were opened on individuals. In the 1980s, many left-wing activists were monitored.
During this period, MI5 monitored peace groups like CND and the Greenham Common protesters as well as other left-wing activists.
Files were opened on CND Chair Bruce Kent and activists like Joan Ruddock, Patricia Hewitt and Harriet Harman, now Labour deputy Leader.
The Ministry of Defence pressed for "ammunition" on CND. In 1983, MI5 provided it with open source material on the political affiliation of seven leading CND members.
This activity came to light in the mid-1980s, when one mid-ranking officer Cathy Massiter quit and spoke out.
But by the late-1980s, counter-terrorism had already begun to supplant subversion as the main focus of activity, dealing first with the IRA and then increasingly after 9/11 with al-Qaeda.
Allowing such a history to be written is certainly unprecedented, but is it wise?
The hope of those who commissioned it is that it will dispel some of the myths surrounding MI5's work, explain what it really does and does not do and the context in which it operated.
The days of monitoring subversion are long past and officials will be hoping that being open about the past will help build the public trust which is now vital to MI5's mission.
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.