LENOIR, N.C. (AP) — A top prosecutor says a Lenoir police officer was justified in fatally shooting a gun-toting man at a northwest North Carolina Walmart store, adding the officer prevented bystanders from being hurt.

Multiple media organizations report that District Attorney David Learner reached his conclusion after reviewing videos captured by the store and police body cameras. Learner says preliminary toxicology tests also found amphetamines and methamphetamine in the bloodstream of 32-year-old Carl Marcus Nivens, who was killed.

Learner says the Lenoir resident was a suspect in a vehicle break-in outside the store and was shooting at police Sgt. Brett Ingram, who returned fire and killed Nivens.

Officers responded to a report of suspicious activity by Walmart employees. Nivens tried to flee before shooting at the officers.

Both Nivens and Ingram were white.