Suspicion of immigrants is nothing new in Britain. In the 1790s it was thought that refugees from revolutionary France would infect Britain with republicanism. Today it is the threat of insidious Islamism. In 2005 Tony Blair faced a similar dilemma to that of the Tory Prime Minister, William Pitt, in the 1790s – how best to deal with a terrorist threat inspired by an alien ideology and to maintain national security.

The sudden unwanted influx of what was seen as a vast number of Britain’s traditional enemies after the Terror of 1792 in France was also considered by William Pitt and his Tory ministers a clear and present threat to national security. In response, they acted swiftly, summoning senior lawyers to Downing Street to advise the Cabinet on what legal measures could be taken to stop the flow.

What resulted was the Aliens Act which required every foreigner arriving in Britain have his or her personal details recorded and registered with a Justice of the Peace. Anyone violating this condition could be held without bail, a measure known as mainprise. They could then be either imprisoned or summarily deported. Those specifically targeted included foreigners with objectionable political views such as suspected spies or agents of the French Republic, or anyone simply considered undesirable by the government. It was an unprecedented event in British legal history.

A new Aliens Office was established under William Wickham to administer the security. Wickham was particularly wary of anyone coming to Britain from Hamburg for it had become a centre of intrigue during the 1790s. So many British and Irish radicals radical exiles were based there that the British consul, Sir James Crauford, had felt it necessary to set up his own small counter intelligence network. Crauford’s part-time spies were ordered to infiltrate Hamburg’s many republican clubs and societies and to pay particular attention to anyone discussing sabotage in the British ports. This has particular relevance today with many Islamists returning from ISIL training in Syria and Iraq.

As the perceived threat of republican infiltration grew more acute the number of ports through which foreigners could enter Britain was drastically reduced in number. Then, a new measure similar to that which the Nazis would impose in occupied Europe in the Second World War, was introduced. This required all British householders to provide the Aliens Office with the names of all foreigners lodging at their premises.

In order to help counter the threat Pitt established a highly efficient secret intelligence department, similar to the modern MI6 and GCHQ. Responsible only to the Prime Minister and his Privy Council this Committee of Secrecy coordinated the often haphazard work of earlier intelligence organisations. Its very existence, when discovered, shocked the relatively open society of late eighteenth century Britain. This was a very un-British organisation, similar to that known to exist in pre-revolutionary France by which the king was able to spy on his own aristocracy. A secret service in all but name, it was ordered to infiltrate both the native revolutionary organisations and the émigré community of French asylum seekers. Given free access to the postal service, this Committee of Secrecy was authorise to open letters at will and to gather financial information about suspected republicans from both the customs and revenue services in a manner uncannily similar to the present-day phone tapping and email interception of Islamic terrorists.

Of almost equal importance in monitoring national intelligence was the British postal service. Since 1711 it had been authorised to open suspect letters and to send copies to the relevant Secretaries of State. Now under the direction of William Wickham at the Aliens Office these ‘interceptions’ became daily events with the post office headquarters at Lombard Street in London becoming an eighteenth century version of the modern GCHQ at Cheltenham. Again much of the evidence was subsequently destroyed but enough remains to show the extent of the operation. The head of the postal service, Francis Freeling, worked closely with Wickham to ensure the efficiency of the intelligence gathering. Every letter with a French postmark was opened as routine for, as Wickham wrote, ‘Suspicion must necessarily attach to any man who is in the habit of receiving letters from France.’ Even respectable English travellers trapped abroad by the outbreak of war in the spring of 1793, including a prominent Whig MP, had their mail intercepted. Some letters were copied and others seized in an attempt to frustrate the communications of the London Corresponding Society and other dissident groups. Where use of a code was suspected, a reliable old forger and seal-breaker, a Mr Maddison, was summoned to use his once illegal skills to reveal the truth.

What happened at Lombard Street was repeated at provincial post offices throughout the country. In particular the local postmasters were ordered to intercept any letter or package that aroused their suspicions. Excitement was aroused in the Swansea office when a worried gentleman arrived and reported that his new Irish servant was corresponding with well-known republicans in Dublin. When Freeling was told, he ordered that all future letters arriving for the servant must be opened and copies immediately forwarded to him in London. In Scotland, the Edinburgh postmaster was likewise ordered to do the same with the letters of a local lawyer that might contain ‘matter of Public Import’. When the subversion was obvious as with the United Englishmen in Lancashire in 1798, the Postmaster-General, Lord Auckland, himself intervened, ordering the Manchester post office not to open the suspects’ mail but to send it immediately to London. As users of certain fundamental Islamic internet websites are closely monitored by the police and secret services today so in the 1790s subscribers to certain radical newspapers came under suspicion.

As the post office continued its surveillance of suspected troublemakers, so the long established Customs service made its own contribution to what would now be known as Homeland Security. Anyone arriving at a British port without a passport was detained or refused entry There was also another legal mechanism in force that even under the current tough British system of 2012 with its adherence to Human Rights law could not be used against suspected terrorists. For in late Georgian Britain any foreigner completing a prison sentence for debt or a similar civil offence could be instantly deported on release from prison without any kind of appeal. Realising its potential in the fight against republican terrorism William Wickham now made sure that such expulsions became part of the Aliens Act.

Pitt’s Whig opponents dubbed this period, ‘Pitt’s Reign of Terror’. In what could be seen as a panic move without factual justification, that cornerstone of British civil liberty, the Habeas Corpus Act, was then suspended. Shortly before the act was passed, thirteen radical leaders including Thomas Hardy and John Horne Tooke were arrested for sedition and their documents seized. So hands-on was Pitt’s involvement in the process that he even questioned the prisoners personally.

The culmination came on 28 October 1794 when Thomas Hardy, in a trial that would rivet the attention of all England, stood at the Bar accused of treason. If found guilty he faced the long established penalty of hanging followed by a barbaric beheading. Eleven others stood ready to follow him into the dock. The prosecution’s opening speech lasted nine hours but no real evidence was produced because they had all been careful to stay within the law. Eight days later the jury returned a verdict of ‘not guilty’. London erupted in jubilation and Hardy’s coach was pulled through the streets by wildly cheering supporters