How do you detain anyone? First, request that he stay until the police arrive. If he declines to do so, physically restrain him until police arrive. Failing that, follow him while in contact with the police, so they can find you and pick him up.
Shooting him was a stupid act; now even if his motives were criminal he's become a martyr.
They didnt shoot him while attempting to detain him. They shot him after he attacked the guy AND grabbed his gun.