The accidental discharge of a pilot’s gun on a US Airways flight was the first time a weapon issued under a federal program to arm pilots was fired.