Former head of MI6, John Sawers (pictured) believes leaving the EU would impact national security Wikipedia

Two former UK spy chiefs have warned a British vote to leave the European Union (EU) would have dire consequences for the country's national security and leave the public at increased risk of attacks from militants. Sir John Sawers, a former head of MI6, and Lord Evans, former director-general of MI5, wrote in a joint article for the Sunday Times that Brexit would dramatically weaken intelligence sharing between the UK and neighbouring nations that is needed to catch criminals.

In a rare public-facing statement, the former spy agency bosses argued that modern intelligence work relies on the "lawful and accountable use of large data sets" to catch cyberattackers and tech-savvy terrorists.

They wrote: "The terms on which we exchange data with other European countries are set by agreement within the EU. As an EU member, we shape the debate, we push for what we think is the right balance between security and privacy and we benefit from the data that flows as a result. An agreement reached without us would probably be too restrictive for our needs… this could undermine our ability to protect ourselves."

National security has emerged as a pivotal topic in the ongoing Brexit debate, which has only intensified after recent atrocities carried out by Islamic State-affiliated terrorists in Paris and Brussels. Those in the Leave camp argue that exiting the EU would enhance the country's ability to govern independently while campaigners in favour of staying – including Prime Minister David Cameron – say the partnership is needed for intelligence and data sharing.

Referencing the upcoming vote, which is currently scheduled for 27 June, the spy duo wrote: "If the UK were to withdraw from the EU, the destabilising effect on the EU itself – already beset with economic difficulties, the migration crisis and a resurgent Russia – could be profound. Those who are enemies of democracy would rejoice."

The pair denied they were working under any government agenda. "We're not doing it at anybody's behest. We are completely politically neutral," said Sawers in a separate interview.

The former agency heads also slammed the position of Sir Richard Dearlove, another former head of MI6, who previously claimed that leaving the EU would make it easier to deport terrorists and control the nation's borders.

"Richard Dearlove left the intelligence world 12 years ago and an awful lot has changed… we work in much closer a partnership with all our partners, not just the United States," said Sawers. "Counter-terrorism is a team game."