The Scottish and UK governments are locked in a dispute over what happens to powers not reserved to Westminster but currently exercised from Brussels, in areas such as agriculture, fishing and environmental protection.