Reality Check: Is Britain safer in or out of the EU?
Following the terror attacks in Brussels, campaigners on both sides of the EU referendum debate have been making claims about whether the UK is safer in or out of the European Union.
In particular, they've stressed the importance of border controls, intelligence sharing, and the role of European courts in Britain's security. The BBC's Reality Check team has taken a closer look at the facts behind the claims.
The biggest issue for many campaigners is how much difference the EU's rules on freedom of movement make to Britain's ability to police its borders.
At the very start of the referendum campaign, Iain Duncan Smith claimed Britain's "open border does not allow us to check and control people that may come", and that made attacks like the ones in Paris in November 2015 more likely in the UK.
On the other side of the argument, Sir David Omand, former director of GCHQ, said: "We are part of an established information sharing network with our partners whilst still retaining control of our border."
So what are the facts? EU freedom of movement allows citizens of all the other 27 EU countries to travel freely to the UK, to visit, study or work.
There is a UK border, and everyone, including citizens of EU-member states, has to produce a passport to cross it. In practice, holders of EU passports are not routinely subjected to detailed checks.
The UK is not a member of the Schengen area of borderless travel. Most EU countries are, as well as some non-EU countries like Switzerland and Norway.
Lack of internal border checks within Schengen has enabled terrorists - and their weapons - to move freely across continental EU, to execute attacks and to escape.
Being outside Schengen and being an island makes travel to the UK harder for potential attackers. But, as noted above, they are not likely to be subject to detailed checks when they try to cross into the UK if they hold an EU passport.
In the wake of the Paris November 2015 attacks, the EU renewed efforts to improve sharing of passenger name record data for flights and there were also calls for the establishment of an EU-wide intelligence service.
One of the most important counter-terrorism measures is sharing information between different security services.
There is no EU-wide intelligence-sharing arrangement, and nor is there likely to be any time soon.
Security and intelligence services are intrinsically secret organisations which share their information only with those they trust to keep their secrets too. That does not apply uniformly across the 28 member states of the EU.
The UK's biggest intelligence relationships lie outside the EU. It shares intelligence with the US and with three other English-speaking countries: Canada, Australia and New Zealand, forming the "five eyes" alliance.
There are direct agreements between certain member states. These are not dependent on membership of the EU - so would they change in the event of Brexit?
Not likely, according to Sir Richard Dearlove, former director of MI6.
In an interview for Prospect magazine, he said: "Britain is Europe's leader in intelligence and security matters and gives much more than it gets in return.
"It is difficult to imagine any of the other EU members ending the relationships they already enjoy with the UK."
While there is no EU-wide intelligence agency, there is an EU-wide enforcement agency - Europol.
It helps fight crime and terrorism across the EU by providing expertise, building criminal databases and supporting investigations on issues ranging from trafficking of people and drugs to money laundering and cyber-crime.
Europol's director, Rob Wainwright, says: "I have seen huge progress in the EU in building up a far stronger capability to fight terrorism and serious crime."
One such advance is the Prüm Convention, an agreement on sharing of DNA, fingerprint and vehicle information, to identify foreign criminals and solve serious crimes. Fourteen EU countries have signed it (the UK voted to join the agreement in December 2015) and it is open to all EU members.
There is also the Schengen Information Service, which is highly valued by UK officials for alerting them to suspects crossing borders.
Then there's the European Arrest Warrant, an EU-wide agreement, that speeds up and simplifies extradition procedures between EU countries.
Last year, the mechanism was used to extradite two British Islamist extremists, Trevor Brooks and Simon Keeler, from Hungary to the UK. In 2005, Hussain Osman, London underground bomber was extradited from Italy to the UK.
Analysis by Mark Urban, diplomatic and defence editor, Newsnight
While I have found many British military and intelligence experts who agree with Sir Richard that Nato defence arrangements and bilateral intelligence exchanges would probably continue unaltered by Brexit, the majority I've spoken to still express opposition to Britain leaving the EU.
They point to emerging security ties at the European level. Missing out on this, they argue, counts for more than the increased ability to control the movement of EU nationals that "outers" such as Iain Duncan Smith argue would make Britain more secure.
When campaigners talk about European courts threatening British security, they're usually referring to the role the courts play in deporting - or, more correctly, blocking the deportation of - criminals and terror suspects.
Most of the examples they're talking about, like the 12-year-long case of Abu Qatada, have been rulings emanating from the European Court of Human Rights (ECHR) or rulings of British courts under the Human Rights Act (HRA).
Crucially, the ECHR is not an EU body. Its job is to uphold the European Convention on Human Rights which was drawn up after the Second World War, partly thanks to Winston Churchill. The Human Rights Act incorporates the convention into UK law.
So leaving the EU wouldn't be enough to get around the convention. The UK would also have to withdraw from the ECHR and abolish the Human Rights Act.
These are things David Cameron has said in the past he's prepared to do, so could the UK just leave the ECHR and remain in the EU? Tricky - legal opinion is divided on whether adherence to the ECHR is a condition of EU membership (as this House of Commons Library research paper makes clear).
Campaigners sometimes refer to another court: the European Court of Justice (ECJ). Its role is to uphold EU law including the right of free movement, and so it can rule on deportations.
Under EU rules, citizens of other EU countries can only be deported or denied entry on the grounds of public policy, public security or public health.
Holding a criminal conviction isn't enough. The person must pose a threat to the interests of society. And the threshold goes up after five and ten years of residence in the UK.
EU law also gives additional rights of entry and residence to the family members of EU citizens even if they're from elsewhere.
That means it's more difficult for Britain to deport or bar entry to criminals who are from the EU or related to EU citizens.
The ECJ is very definitely an EU institution, and so if the UK left the EU it would cease to be bound by its rulings. Instead the government could introduce new rules which made it easier to block people or throw them out, subject to other international agreements
READ MORE: The facts behind claims in the EU debate