An Anoka County sheriff's deputy and a Coon Rapids police officer were legally justified in fatally shooting a 40-year-old man from Cass Lake, Minn., who fired at them after a routine traffic stop in April in Coon Rapids, the Dakota County Attorney's Office announced Wednesday.

Dakota County reviewed the state Bureau of Criminal Apprehension's investigation of the shooting of John Duane Fairbanks at the request of Anoka County to avoid any conflict of interest. The investigation included an examination of body camera, squad car and drone footage.

According to investigators, about 1:40 a.m. on April 18, Coon Rapids police officer Geoff Neumann stopped a vehicle in which Fairbanks was a passenger. A fellow officer, Alex Hattstrom, stopped to see if Neumann needed help. As the two approached the passenger side of the vehicle to give the driver a verbal warning, Hattstrom spotted a hypodermic needle on the floor behind Fairbanks' seat. They ordered Fairbanks out of the car, and he fled on foot after pulling a handgun from his pocket.

During the ensuing chase, Fairbanks fired at the officers several times and Hattstrom fired back, investigators said. The officers, who were not hit, took cover to wait for backup.

Officers from several jurisdictions quickly responded. A police dog found Fairbanks in a yard and was holding him by the leg when, according to Dakota County Attorney James Backstrom's report, "members of the tracking team observed Fairbanks pick up a firearm with his right hand and hold it behind his back."

"Members of the tracking team repeatedly shouted for Fairbanks to drop the firearm and show them his hands," Backstrom wrote. When he would not, Anoka County sheriff's deputy Christopher Vitek fired three shots. "Immediately after these shots were fired, another officer … approached Fairbanks as he lay on the ground. Fairbanks was holding a gun in his right hand with his finger on the trigger guard," the report said.

The two officers were legally justified in shooting Fairbanks and no charges are warranted, Backstrom said.

Toxicology tests found fentanyl, methamphetamine and marijuana in Fairbanks' bloodstream, investigators said.

"Although I have concluded that the use of deadly force … was legally justified in this instance, any loss of life is a tragic occurrence, and I wish to express my sympathy to the family and friends of John Duane Fairbanks," Backstrom said in a news release.