The pilot of a US Airways plane may have been mishandling a firearm when it went off in flight, piercing the cockpit wall before the jet landed safely, a federal air marshal said Tuesday.