BOISE -- Boise Police officers were cleared Friday in the shooting death of a man who killed a dog and shot at officers in Hulls Gulch earlier this year.

Blaine County Prosecutor Jim J. Thomas wrote the six officers were "completely justified" when they opened fire on 42-year-old Benjamin Barnes March 18.

RELATED: Foothills shooting witness: A dog 'yelped in pain'

“The officers utilized lawful legal force in reaction to a deadly threat when Benjamin Barnes pointed a semi-automatic handgun at them and discharged several rounds towards the officers after officers gave verbal commands to come out of the bushes and show his hands," Thomas said in a release. "The video and photography evidence depict the crime scene area at the time of the incident as being on an open hillside with sage brush, small trees and ground vegetation. The officers were essentially without protective cover when Barnes began shooting at them while being approximately 50 yards away. The actions of the Boise police officers in shooting Benjamin C. Barnes were completely justified in order to neutralize the lethal threat that he (Barnes) presented to not only the police officers but to citizens who may have unwittingly come upon the scene.”

MORE: Police: 6 officers fired at suspect in foothills shooting

Barnes, a transient, pulled out a handgun at the popular hiking area and yelled at one woman about her dog being off-leash at about 8:12 a.m., according to the prosecutor. Officers looked for him, but did not find him.

About an hour and a half later, Barnes shot and killed a dog named Moses and pointed a gun at the pet's owner, prompting more calls to police.

Officers found Barnes hiding in bushes, and ordered him to come out, telling him he was under arrest. At that point, Barnes took "an aggressive shooter's stance" and fired several rounds toward the officers, Thomas said.

BODY CAM: Police release video of the exchange

Six officers - Eric Johnson, Robert Johnson, Andrew Johnson, Chris Zimmer, Chris Wirshing and Tyjuan Lynn - returned fire, killing Barnes.

RELATED: Coroner identifies man shot by police after killing dog in foothills

“This was a very dangerous situation for our officers and for the community, my deepest thanks go out to the officers who put themselves in the line of fire to protect our citizens,” Boise Police Chief Bill Bones said in a release. “While our hearts go out to both Barnes’ and Moses’ family for their losses, we are grateful no additional members of the community or officers were injured or killed.”

“We would also like to thank a number of agencies who assisted with this critical incident. Thank you to the Boise Fire Department and Ada County Sheriff’s Deputies for helping us restore safety in the foothills and secure a very large scene. We would also like to thank the Meridian Police Department for their complete and through investigation as well as the Blaine County Prosecuting Attorney for their work,” Bones continued.