Writing for Business Insider, the UK’s former national security adviser Sir Mark Lyall Grant says Brexit needn’t damage national security – but leaving without a deal would be disastrous and must be avoided.

Despite some recent alarmist reporting, there is no reason why Brexit should damage UK national security. As National Security Adviser, I oversaw the 2015 Strategic Defence and Security Review, which identified four major strategic threats to the UK: State-based threats, especially from Russia; terrorism and extremism; cyber threats and the erosion of the rules-based international order.

In the last three years, all four threats have intensified. But our membership of the EU is not a critical factor in our response to any of them. NATO, the five-eyes intelligence community, our permanent membership of the UN Security Council and bilateral arrangements with key partners, such as the Lancaster House treaty with France, are all more important. It is telling that, of the 89 separate commitments in the 2015 review, only one referenced the EU – a commitment to champion an EU India Free Trade agreement.

I do not want to suggest that there are no implications at all. The most important is the network of European information sharing and practical measures that help British law enforcement and intelligence agencies tackle serious organised crime, secure our borders and combat terrorism. We shall want to be as closely associated as possible with EUROPOL on issues such as cybersecurity; access the Schengen and Prum databases, which store DNA, fingerprint, vehicle and other personal information, to help keep track of criminals; get traveller information from the Passenger name records; and operate the European Arrest Warrant. All these systems are owned and run by the EU.

The UK clearly has a strong national security interest in reaching agreement on these issues, so that the current close cooperation can continue smoothly after Brexit. The Government has proposed a bespoke 'security treaty', essentially aimed at retaining current levels of cooperation, but minimising the role of the European Court of Justice.

The Commission negotiators have not yet responded in detail, as they continue to focus on the Irish border issue. But, even in the event of a 'no-deal' Brexit (which would be disastrous economically) I am confident that a satisfactory arrangement will be found on security. This is because our EU partners have at least as great an interest in continuing to benefit from UK cooperation. UK intelligence services are recognised as the best in Europe, we have the largest defence and aid budgets of any EU country, our military engagement is highly prized and we arrest and send back to their own countries eight times as many EU nationals under the European Arrest Warrant as we get back from the continent. In this sense, we are in credit on National Security - which is not the case in many other areas of the Brexit negotiations. I know from my time as NSA that this reality is well understood by European leaders. President Macron may talk wistfully of creating a European army, but he knows that, without UK input, Europe will never be able to pull its weight on defence.

In fact, the greatest threat to national security from Brexit is the performance of the UK economy. As the 2015 review made clear, you cannot divorce national security from economic security. If the UK's economy suffers as a result of Brexit, then our national security will inevitably also suffer. Put at its most basic, if the pound depreciates against the dollar, then our ability to fund the ambitious defence procurement programme will be put at risk, whether we continue to spend 2% of GDP on Defence or not. So security is yet another reason why protecting the UK's economy must be the Government's top priority in the negotiations.

Sir Mark Lyall Grant was the United Kingdom's national security adviser between 2015-17 and has also served as a permanent representative of the United Kingdom to the United Nations.