AT LEAST one aspect of Brexit should be simple. Everybody agrees that maintaining co-operation on defence and security is desirable. As Rob Wainwright, the outgoing (British) director of Europol, the EU’s police agency, puts it, politics should not be an obstacle, as it may be for trade. Yet fiendish institutional and legal problems over security abound, and there is little time left to surmount them.

Theresa May wants a new treaty on security, to remain in Europol, the European Arrest Warrant and other agencies, and to co-operate in defence and foreign policy. She is keen to retain full access to the EU’s extensive databases for security and intelligence. Indeed, she hopes to stay closer to these than Denmark, which is in the EU and the Schengen frontier-free zone but has opted out of many justice and home-affairs policies.

Achieving this will be hard. Several agencies have no legal basis to admit non-EU members. Some countries will extradite nationals only to other EU countries. All agencies come under the European Court of Justice (ECJ), whose jurisdiction Mrs May insists on escaping.

The biggest issue is data protection. To gain access to EU databases Britain needs a “data adequacy decision” on privacy from the European Commission. Non-members can secure this, but America was denied a full one in 2015.

Britain is seen as keener to share data with America than others. The EU frets that post-Brexit Britain is ditching the charter of fundamental rights, including its data provisions. It has also complained about lax British protection of crime data in the Schengen information system, to which Britain has access. And in 2016 the ECJ ruled against a British investigatory-powers law, forcing the government to amend it. The House of Commons Home Affairs Committee duly accuses the government of worrying complacency about securing a data adequacy decision.

This is where politics may intrude, after all. Several EU countries and the European Parliament believe that when sharing data Britain (like America) gives security and intelligence higher priority than privacy. But some will exploit this for commercial advantage. A good example is the Galileo satellite project. After Brexit, Britain faces exclusion from the most militarily sensitive encrypted part of Galileo. That reflects high-minded worries over data security, but also low-minded hopes of hoovering up lost British contracts. As Sophia Besch of the Centre for European Reform, a think-tank, notes, this shows how petty rivalries risk damaging broader co-operation in defence and security. The stakes could hardly be higher.