One of the things the K9s are trained to do, is to launch themselves @ the gun arm, whereby the gunman drops the gun. That way, the gun can't be used on the bad guy OR the good guys. It's used quite often. The human cop was very justified in his actions, IMO.
RIP Ivan - Thank You for Your Service.