Britain remains committed to the defence of Europe despite leaving the European Union, Theresa May has said.