Danish police said three people were detained in Denmark on Thursday, and one in the Netherlands, on suspicion that they had prepared to carry out a terrorist attack.