European Union justice and interior ministers have agreed on a counter-terrorism strategy aimed at preventing recruitment by terrorist groups .