Leaving the EU would make the UK "less safe", a former intelligence services chief has warned.
Former MI6 boss Sir John Sawers told the BBC's Andrew Marr that the UK would be shut out of decisions on the "crucial" issue of data sharing.
But Justice Secretary Michael Gove, who backs the campaign for the UK to leave the EU, said Sir John was "flat wrong".
He told the programme many security experts did not think that "Brexit" would harm Britain.
Security is the latest battleground in the run-up to the referendum on the UK's EU membership on 23 June.
Sir John and ex-MI5 chief Lord Evans stepped into the debate with an article in the Sunday Times.
Sir John told the BBC that he and Lord Evans, who led MI5 until three years ago, had waited to intervene until after Thursday's elections.
He said: "The reason we would be less safe [if the UK voted to leave], is that we would be unable to take part in the decisions that frame the sharing of data, which is a crucial part of counter-terrorism and counter-cyber work that we do these days, and we would lose the abilities of thing like the European Arrest Warrant."
He said the UK leaving would also threaten wider European stability, saying: "We are only secure because the wider Europe is secure, pulling out will make it more dangerous."
Sir John said that, thanks to data sharing within the EU, the French had been able to transfer DNA and fingerprints of one of the Brussels bombers - the kind of thing which used to take months - within minutes.
He rejected claims that the European Court of Justice was getting in the way of security, adding: "I think judges tend to err on the side of human rights rather than erring on the side of security. That's beginning to change as judges understand the scale of the security threat that Europe faces."
Mr Gove told the BBC the ECJ had interfered in the UK's capacity to share data and intelligence with the US and stopped it deporting people "whose presence here is not conducive to the public good".
He said the European Criminal Records Information System did not allow the UK to know whether or not criminals had entered the country. "We only find out whether or not people have criminal records after they commit an offence in this country. It's a gossamer-thin protection."
He argued that removing the UK from the ECJ's remit post-referendum would be among "immediate steps in order to make this country safer".
He said many security experts did not agree with Sir John' analysis.
"Ron Noble, who's the head of Interpol, says that the European Union's open borders policy is like hanging out a welcome sign for terrorists.
"Richard Dearlove, the former head of MI6, says that open borders policy, and also the way in which European courts operate, is against our interest. Richard Walton, the most recent head of anti-terrorism at the Met, say that we would suffer not one whit by being outside the EU."
Sir Richard, who led MI6 from 1999 to 2004, wrote recently that the cost to Britain's security of leaving the EU would be low.
- Subscribe to the BBC News EU referendum email newsletter and get a weekly round-up of news, features and analysis on the campaign sent straight to your inbox.