A lock and target authentication apparatus for handguns and rifles. The apparatus is designed to fit into handgrips that replace the factory provided handgrips. Flexible membrane circuitry is contained within the handgrips as well as the power source for the apparatus so that the unit does not have to made part of the weapon and can easily be added afterward. The only other modification of the weapon that is necessary is to make a slight change to the trigger assembly or trigger bar. An infra red signal is communicated from a remote transmitter that unlocks a solenoid mechanism that prevents the weapon from being fired. The signal is unique to the weapon. The apparatus also features a target authentication ability so that a number of weapons can communicate with one another to prevent a weapon from being fired at them if that weapon receives a preselectable infra red signal that indicates to the apparatus that the other weapon is a "friend" and not a "foe".