I think you're a little off track. Z had the gun on his person, but he was under severe duress, and according to some accunts I've read, he stated he even forgot he had it. It was when M noticed it that the gun became the focal point of their struggle. I guess at that point one or the other of them was going to be shot. Here it's a matter of a split second. I have to suppose that the disposition of the weapon was favorable to Z, and he reacted fast enough to turn the event his way.
Either way it’s justifiable homicide, no?