An Albuquerque police detective has testified that an officer charged in the shooting death of a homeless man said the encounter unraveled when the man held two knives and took a defensive stance.

Detective Geoff Stone, the lead investigator in the 2014 shooting, said Tuesday that then-Detective Keith Sandy, one of two defendants in the case, said James Boyd was acting erratically at a campsite.

Stone said Sandy told him he felt officers were in danger because of their position near a hill and because Boyd refused to obey commands.

Sandy told Stone that Boyd placed knives in both hands at chest level and had a defensive posture.

Officer Dominique Perez and Sandy are charged with murder. Stone was testifying at a preliminary to decide if they must stand trial.