Man discards firearm on seeing cops, arrested