Abstract: A safety device of a gun includes elements for determining the geographical location of the gun and the shooting direction, elements for receiving via a short range radio link from a gun user's mobile phone a safety area map related to the current location and location data of moving or fixed targets in this safety area. The safety device additionally has elements for determining those moments, when the gun is in the shooting position. When the gun is in the shooting position the safety device determines the risk area, within which there must be no targets preventing shooting. The safety device determines the size of the safety area based on the type of gun and the shooting direction of the gun. If it is detected that there are targets preventing shooting in the determined risk area, then the safety device generates a warning detectable with humans senses regarding this.