Ministers urgently need to strike a deal with the European Union on data and information sharing after Brexit, two former spy chiefs have warned.
Ex-MI6 chief Sir John Sawers and Robert Hannigan, the former director of GCHQ, said it was essential the UK continued to have access to intelligence about terrorists and other "bad actors" trying to enter the country.
Speaking to the BBC, Mr Hannigan said agreement would effectively mean giving the European Court of Justice (ECJ) a say when it came to regulations governing the protection of privacy.
Sir John told the BBC: "Europe is going to be our security back yard for ever and we need to be able to work very closely with our European partners in order to maximise our own security."
He said it would be "a very serious problem" if there was any impediment to the flow of information.
"The intelligence these days is based very heavily on having access to data and being able to identify bad actors - things like advance notice on aircraft or ships coming to the UK. We need to have access to that," he said.
"We have been an active player in that within Europe and now European rules will be made without us and we will be outside the immediate legal framework.
"But that is something that the British Government is going to have to address very early on - how we can make sure we continue to retain data and we have some say in the rules that are drawn up in the European Union."
Mr Hannigan said Britain could not simply rely on data circulating within UK borders which would effectively mean "cutting ourselves off from the modern world".
"That means what the EU regards as adequate regulation of privacy (and) protection of privacy is incredibly important to us and it does effectively give the ECJ a say in what we do," he said.
He said experience in negotiating a agreement between the EU and the US suggested that reaching a new agreement was likely to be a lengthy process but it had to be done.
"The UK equivalent - which we will now need to negotiate - will be very difficult and we will have to take some time to do it. But it's vital to the economy broadly," he said.
Sir John and Mr Hannigan warned against trying to use continued access to Britain's extensive intelligence-gathering capabilities as a "bargaining chip" in broader Brexit negotiations.
Sir John said: "If either side try to use it as a bargaining chip or a point of leverage it's likely to be negative on both sides."
Mr Hannigan added: "I've never thought this was realistic or indeed ethically sound. How could you possibly think of withholding material that might stop a terrorist attack in exchange for fish quotas or something? It's absurd."