Prosecutors have reviewed a case where a Salt Lake City police officer who shot and killed a mentally ill man holding a gun, injuring his colleague in the process, and determined the shooting was justified under Utah law.

Salt Lake County prosecutors said Friday in a letter to Police Chief Mike Brown and Salt Lake County Sheriff Rosie Rivera that it was clear that Officer Scott Robinson believed that if he didn’t shoot Michael Brand, that Brand was going to hurt or kill someone else.

The shooting occurred July 15, after staff at the Sunrise Metro Apartments called the police nonemergency line to report that Brand was “acting abnormally and being aggressive towards staff.” Brand had been diagnosed with psychiatric disorders. In a dash camera video, a staffer tells police Brand was reeling from the recent death of his friend.

Three Crisis Intervention Team officers were called to the apartments and went to Brand’s door, according to the letter.

Robinson knocked, and when Brand opened the door, he was holding what appeared to be a black handgun. Robinson told prosecutors he saw Brand point the gun at an apartment staffer and then his colleague, Detective Mike McKenna. He said he believed Brand was going to shoot McKenna.

The staffer also told investigators that Brand pointed the gun at her, and body camera video shows Brand opening the door while holding the gun.

Robinson fired his gun three times, hitting Brand and McKenna.

He told prosecutors he knew McKenna was in his line of fire, but thought he had to shoot to save McKenna’s life. Brand died. McKenna was injured and has recovered.

McKenna told prosecutors that after he’d been shot, Robinson told him, “Mike, it was me. I’m sorry. I had no other choice, the guy’s gun was pointed right at your head.”

Investigators later learned the gun Brand was holding was a paintball gun. A neighbor told investigators that he didn’t think police would have been able to tell it wasn’t a real gun.

A man who’d been in Brand’s apartment drinking alcohol with him that morning told investigators that when police knocked on the door, he didn’t think it sounded like a “police knock.” He said he didn’t see Brand point the gun at anyone.

District Attorney Sim Gill said Friday that while some may see this as a straight-forward case, it wasn’t. He called it a “tragic loss of life.”

And, he said, “Anytime there’s a loss of life that happens in our community, regardless of what the underlying circumstances are, I think it deserves a very deliberate and cautious look at it, because law enforcement, while they have the authority to use that force, it still has to used it in the right context.”

In this case, Gills said evidence shows officers acted lawfully.