PIERRE, S.D. (AP) — South Dakota’s attorney general said Friday a Sioux Falls officer was justified in the fatal shooting of a man police say threatened them with a knife.

Forty-one-year-old Cody Wade Kelly was killed after police conducted a welfare check at his apartment on March 31 because he had threatened to harm himself. Officers found Kelly in the bathroom of his apartment armed with a knife and with wounds to his arms.

Police shot him with a nonlethal bullet and used a stun gun to subdue him, but neither worked. State investigators say an officer shot Kelly multiple times after he stabbed one officer in the leg and threatened others with a knife. He died at a hospital.