A motion sensing device (110) is embedded in a firearm. A processor (120) in the firearm senses the pattern of motion of the firearm, and on sensing a specified sequence of motions, the processor (120) permits operation of the firearm. The operator would move the firearm in a prescribed fashion to "unlock the gun." For example, the operator might trace out his or her initials with the muzzle of a pistol. Unlocking would stay valid until the operator released the gun handle or squeezed extra hard on the handle.