UK intelligence services

The UK intelligence services are the various intelligence and secret services that are part of the apparatus of the government of the United Kingdom. They are variously responsible for internal security, foreign intelligence, and espionage, and are an important part of the machinery of the state.

However they have done various less defensible things, including mass surveillance programs against innocent people. They also feature prominently in many conspiracy theories, including allegations that one or more have acted as a shadow state, seeking to destabilise legitimate governments. There are also numerous Cold War-era claims about double agents and widespread communist infiltration.

The main agencies are:
 * MI5 (the Security Service), responsible for domestic security including combatting terrorism and foreign spies; in its history it has also had various roles in combatting organised crime, and conducting surveillance in the UK.
 * MI6 (the Secret Intelligence Service or SIS), whose chief role is gathering intelligence outside the UK, in other words spying. It is broadly analogous to the CIA in the US.
 * GCHQ (Government Communications Headquarters), responsible for signals intelligence and information security, similar to the NSA in the US.
 * Defence Intelligence (DI) is the main organisation responsible for military intelligence. There were various military intelligence units involved with the regular army in The Troubles in Northern Ireland, such as (14 Intelligence Company). Other units include the  (formed 2005 for counter-terrorism work).

Also of interest is, a department of the police involved at various times with national security, intelligence, and anti-terrorism work.

History
There have been spies, spy-catchers, and other shady goings-on as long as there has been people in power fearful of losing power, although for a long time they were more or less ad hoc, often built up during wartime and then disbanded afterwards. The current intelligence agencies framework dates from the fear of German invasion in the run-up to World War One, with changes in World War Two and at the start of the Cold War, and a later search for purpose after the end of the Cold War and a repurposing towards Islamist terrorism. The widely-used but unofficial names MI5 and MI6 date back to the World War One-era divisions of the British secret service.

For many years the secret services were very secret, and not officially acknowledged by the government. However since the 1980s they have been put on more of a statutory footing with some (limited) oversight, rules, fancy public buildings, and occasional government comments about their existence. The Intelligence Services Act 1994 provided a legal framework for their operation.

There are many former organisations. The Naval Intelligence Division was active from 1882 to 1964, and helped inspire sexy spy James Bond. The Special Operations Executive was in operation during World War Two, but disbanded in 1946. The former Special Branch of the Metropolitan Police took a leading role in combating domestic terrorism as well as involvement in protecting VIPs and security at ports.

Cambridge spy ring
This was a group of spies who attended the University of Cambridge in the 1920s or 30s and worked in various arms of the British government including MI6 and the Foreign Office. They were chiefly active in the 1930s and early 1940s when they passed intelligence about Hitler to the USSR (boo! hiss!), although some remained in positions with access to secrets until the 1950s. The four known members were Donald Maclean, Guy Burgess, Kim Philby, and Anthony Blunt, but there are numerous rumors about a fifth man, and possibly others, with John Cairncross the best-supported candidate. After being unmasked, Burgess, Maclean, and Philby fled to the Soviet Union. Blunt put his Cambridge education to good use as Surveyor of the Queen's Pictures (basically the Queen's pet art historian and curator); he also wrote what is still the standard text on the French classicist painter Nicolas Poussin; his treason was kept secret for several years to avoid embarrassment. All this showed the failings in MI5, which was supposed to catch spies, but led to theories that the organisation was itself riddled with communists.

MI5
MI5 has for a long time been responsible for combating foreign spies in the UK, operating for 100 years with varying degrees of success. It has also had a variety of other roles against domestic threats, including terrorism and other political activists perceived as a particular threat, and for a while organised crime. It is under the authority of the Home Secretary. Its director general is Andrew Parker since 2013. Since 1995 it has been headquartered at Millbank in London near the Houses of Parliament.

History
It derives from part of the Secret Service Bureau founded in 1909 to combat the threat of Imperial Germany; the section dealing with internal counter-espionage was formalised and known as MI5 at the start of World War One. In the inter-war years it went through a series of troubles. It was infiltrated by Irish pro-independence agents under Michael Collins, and was not terribly successful at preventing Irish independence. It had some overseas operations, including employing Benito Mussolini for a while. In the 1930s it was infiltrated by a communist spy ring including Kim Philby, Anthony Blunt, Guy Burgess, and Donald Maclean, known as the Cambridge Spy Ring because they had the finest education money could buy.

It was reorganised during World War Two and became very effective at catching German spies and turning them into double agents feeding false information to the Nazis. Yay. During the Cold War its record was more mixed. It failed to catch many communist spies, and there was suspicion it was riddled with them. It also spied on left-wingers and trade unionists. Boo. It was involved in countering terrorism in Northern Ireland during the Troubles, although it did not take a lead role there until after the end of the Cold War. It also had a problem with whistleblowers, notably Peter Wright (Spycatcher) and David Shayler, both of whom alleged large-scale wrongdoing, infiltration, and other conspiracies, although there seemed elements of fantasy to both men's claims. Post-1990 it searched around for new tasks, combating Islamist terrorism, and providing intelligence against organised crime for a while, though this work was later taken over by the Serious Organised Crime Agency and its successors. It is increasingly focusing on far-right terrorism, some would say belatedly.

Various governments, including those of Harold Wilson and Margaret Thatcher, tried to get MI5 involved in disputes with trade unions. Wilson sought MI5's help in a 1966 dispute with the seamen's union, and they provided him with talking points to use in a speech. Thatcher got MI5 to spy on the National Union of Miners during the 1984-85 miners's strike, uncovering the shocking revelation that the Communist Party was telling the miners to be less militant.

Peter Wright
Wright was a former MI5 agent who after retirement wrote Spycatcher, published in 1985. This followed several years of trying to get people interested in his conspiracy theories about communist infiltration, including Red-baiting journalist Chapman Pincher; Wright was also angry that no action had been taken against Cambridge spy Anthony Blunt. Spycatcher is generally reckoned a not very accurate book about the British intelligence services. Its main claim was that Sir Roger Hollis, head of MI5 from 1956 to 1965, was a spy for Soviet Russia. Nonetheless, Margaret Thatcher was determined that it had to be banned and she took out injunctions preventing publication in England and Wales - although not in the USA or in Scotland. Eventually Thatcher's lawsuits failed, and the book was published, selling 2 million copies, a classic example of the Streisand effect - but Thatcher tightened the Official Secrets laws in 1988 to make sure it didn't happen again.

Surveillance of peaceful lefties
As well as watching actual spies, MI5 has for a long time kept an eye on other, less dangerous "enemies of the state". These include:
 * Trade unionists, including Jack Jones, head of the TGWU, one of Britain's biggest trade unions at the time, as well as seamen in the 1960s and miners in the 1980s.
 * Peaceful anti-nuclear campaigners, such as the Greenham Common Peace Camp, a group of women who lived in tents near an air base in protest against the deployment of nuclear weapons, and Bruce Kent, head of the Campaign for Nuclear Disarmament (CND).
 * Joan Ruddock, who was involved in CND and later a Labour MP.

David Shayler claimed that MI5 also had files on other senior Labour politicians including moderates Peter (later Lord) Mandelson and Jack Straw, as well as public figures including John Lennon; however these claims haven't been independently corroborated.

MI6
MI6, or more formally the Secret Intelligence Service (SIS), is focused on human intelligence (HUMINT) overseas, which basically means running British spies in foreign countries. According to law, it is not supposed to operate in the UK. While in the past it spied on Britain's enemies (Germany and later the Soviet Union), it now claims to be focused on countering terrorism, nuclear proliferation, cyber attacks, and similar threats to the UK. It is accountable to the Foreign Secretary in the government. Its headquarters since 1995 have been at Vauxhall, London, in an absurd postmodern ziggurat designed by Terry Farrell, which is the antithesis of secret.

History
It was founded in 1909 as the Secret Service Bureau, with its first director Captain Sir Mansfield George Smith-Cumming, known as "C" (for "Cumming"). Its first target was Imperial Germany, but after the Russian Revolution and end of World War One, this switched to the communist menace. It was still cooperating with Nazi Germany in the fight against reds as late as 1937, but did eventually swing into operation against Hitler. After World War Two, it absorbed the Special Operations Executive, which had conducted clandestine operations in Europe during the war. It focused on communism again, and despite being itself infiltrated managed some successes. After the fall of communism circa 1990, it was downsized, but found a new focus after 9/11 with the war on terror.

Torture and rendition
After 9/11, MI6 agents were involved in obtaining information from suspects who were subject to extraordinary rendition and torture, with Prime Minister Tony Blair and other senior Labour figures such as Jack Straw and David Blunkett either directly involved or deliberately looking the other way, sticking their fingers in their ears, and going "la la la la la". The British funded rendition to governments known to torture and abuse prisoners, and used information obtained by torture, although it is unclear whether British agents physically tortured suspects or left that to other less high-minded governments.

GCHQ
Government Communications Headquarters (GCHQ) is responsible for cryptography and electronic surveillance, and has two main areas of operation, gathering intelligence via surveillance and code-breaking, and ensuring the security of British communications. Its director since 2017 is, formerly of MI5.

History
It was formed after World War Two from the Government Code and Cypher School, which was established in 1919 and famously employed Alan Turing at its wartime HQ in Bletchley Park. It later moved to Hillingdon on the western outskirts of London, and in 1951 to Cheltenham in the west of England. It also had offices in Palmer Street, Westminster, London, from 1953 to 2019.

Geoffrey Prime
One of the most notorious figures associated with the organisation was Geoffrey Prime, who was eventually unmasked as a spy for the KGB (Soviet intelligence agency). He was also a pedophile and attacked a number of young girls. After police interest in his sexual crimes, his wife reported him as both a pedophile and a spy. The government then had to admit that one of the employees of their intelligence service was a member of the Paedophile Information Exchange. In 1982 he was convicted of both spying and sexual offences, and eventually left jail in 2001.

Trade union ban
Margaret Thatcher banned staff at GCHQ from joining a trade union in 1984. This led to strikes and one of Britain's longest trade union disputes, until the ban was lifted by the new Labour government in 1997.

Mass surveillance
GCHQ is involved in a variety of signals intelligence operations including monitoring telephone and internet communications.

In 2013, Edward Snowden revealed details of GCHQ's program, which was trialled in 2008 and came into full operation in 2011, as well as British participation in the American  scheme. Tempora monitored internet traffic to and from the UK via taps on 200 fibre optic cables, with the apparent cooperation of the various data companies. This data was analysed by a large team at both GCHQ and the NSA in the US, which scanned through the data for specific phone numbers and keywords. It reportedly could log 600 million "telephone events" per day, and could actively monitor 46 fibre-optic cables at the same time, each carrying 10 gigabits per second. Following Snowden's revelations the UK government attempted to stop media from reporting anything about PRISM and Tempora using a D notice, a theoretically voluntary message to the press and broadcast media, but news sources including the Guardian and BBC reported details anyway.

The legal basis for the intercepts was murky: GCHQ has wide powers to monitor foreign communications but a specific warrant is required for monitoring of anyone in the UK, although in practice domestic internet is often routed overseas for part of its journey so there is no way of separating the two. In 2018 the European court of human rights found that the bulk surveillance violated the right to privacy (article 8), but its provisions for sharing data with other governments such as the US did not violate articles 8 or 10 (free speech); this was hailed as a victory by Snowden and other human rights campaigners.

Katharine Gun
Gun was a 28 year old worker at GCHQ when she discovered an American plan to spy on the United Nations in the run-up to the Iraq War, to bolster the US's case for war or discredit its opponents. She leaked an email from senior NSA figure Frank Koza to the Observer newspaper. The British government threatened to prosecute her, but then the case was dropped - sparking additional conspiracy theories about why. it is likely that Tony Blair's government was unable or unwilling to reveal some details of its operations or American operations in court, but it was never clear exactly what.

Computer hacking
It also has extensive capabilities at Computer and Network Exploitation (a euphemism for hacking computer systems). In 2015 a court case revealed the extent of its hacking operations, with around 20% of intelligence reports containing information from hacking and GCHQ having the ability to implant persistent malware or spyware on targets' computers.