Denmark’s state prosecutor said on Friday that a 31-year-old man had been charged with planning a terrorism attack with knives and explosives in Copenhagen three years ago.