A firearm that automatically controls the release of bullets, including one or more sensors that provide real-time sensor data of the view in front of the firearm, a computer that identities legitimate targets in the real-time sensor data, without user intervention, a trigger sensor that determines directly or indirectly if the trigger is engaged, wherein as long as the trigger is engaged, the firearm is configured to continuously acquire real-time sensor data, identify legitimate targets and automatically release bullets when the firearm is directed toward the identified targets.