While keeping sight of the UKs national interests is important almost all of them can be carried out as well with the European Union as outside it. In particular the whole of Europe is interested in preventing terrorism. In other areas such as maritime security it makes sense for the UK to specialise in it while other countries specialise in other areas such as having larger armies. Moreover it should be noted that the UK is in one of the safest areas of the world with no hostile states in any direction. In this sense the EU is a buffer between the UK and less stable areas such as North Africa, the Middle East, or Russia so it makes sense to work with them as part of the same organisations including the EU.