A police officer was among those killed in the attack in Boulder, for which a suspect has been detained.