Gunman jailed after being shot by police while fleeing in nothing but pants