As a reminder, there are four different types of NPC security forces in high-security space, triggered by different conditions:
CONCORD, arriving when a character commits a criminal aggression as part of a Global Criminal Flag, by engaging another player or player assets without having rights to do so.
Empire police, intervening when a player with too low security status jumps into high-security space. The exact numbers are:
-2 and lower: police attacks the player in 1.0 systems.
-2.5 and lower: police attacks the player in 0.9 systems.
-3 and lower: police attacks the player in 0.8 systems.
-3.5 and lower: police attacks the player in 0.7 systems.
-4 and lower: police attacks the player in 0.6 systems.
-4.5 and lower: police attacks the player everywhere in high-security space.
Empire customs, taking action when contraband is found in a player's cargo hold.
Empire navies/militaries, reacting if a player with the FW flag or -5 and less faction standings jumps into an enemy high-security system.
Players with -5.0 or worse are considered outlaws. They can travel the same as any player with -4.5 or worse. Concord will not intervene if you try to kill outlaws and killing them does not lower your security status. Note however that this has nothing to do with bounties. Bounties on players are put there by other players. If you succeed in killing the player, you receive the reward, regardless of what you're doing is legal. Concord completely ignores bounties.
So when is it legal to kill someone?
In 1.0 - 0.5 systems, Concord will arrive on the scene and you lose security status
In 0.4 - 0.1 systems, Concord won't come, but you still lose security status
In 0.0 systems or below, nothing happens (see text below about 'below 0.0')
According to some, Concord will arrive faster in systems with higher security, but this has not been shown conclusively.
Note that you don't have to kill someone for Concord to come. You just have to attack them. Locking and scanning someone is not considered attacking. Scrambling, webbing, jamming, painting, etc. (basically, anything that hurts the target ship) is considered attacking. Also, if you are helping someone who is considered an attacker (for instance by repairing armor or shield), you are also considered an attacker!
Note that the lowest possible system security in EVE is not 0.0, but -1.0. Your EVE client won't show it, but when determining the level of the local rats and the ore for instance, EVE will use the -actual- security. Also, security in EVE is really not a 2-digit number, but a lot more precise. This means that a system like Karan, with a security of 0.0447 is reported as 0.0, but is in fact above 0 and you -will- get security hits in systems like these.
My security status is ok, but I still got ganked, what gives?
If you tried to dock at a station, or ran into patrolling ships, check your standing towards the corp that owns it. If it is -5.0 (or is it -2.0? Anyone?) or below, they will consider you an enemy and will attack on sight if you try to dock or get too close to their stuff.
If you activated some weapon (jammers, scramblers, webbers are all considered weapons) against one of the structures or ships there, you will get shot. Be very careful, especially with smartbombs, since they hit everything around you.