When a player has an exclamation mark above their head, which is shown as ❗️, this means the player is in hostile mode. They are not innocent, and as a guard, you can and should kill or arrest them.
To deactivate it, go to Settings > Gameplay > Hostile mode