Due to some lag, it will often happen before you can attack, that a monster is distracted and will attack a player who is in the recognition area, which is a "ring" between a minimal and maximal distance. The minimum was introduced to avoid players being killed while logging in after crashing in a fight. So if you are right at the spawn point, the NPC won't recognise you, but instead the one a few steps away - target him, and attack him. Before you are able to target and attack, the server already moved the NPC away, so chances are that your attack command may select the second near NPC, but not the nearest you expected.
(That way I often caught the strong rogue or the Brigand instead of the weaker one, which I wanted to attack instead of letting him disturb another player who was fighting the Brigand, when there was a bunch of 3.)