This command will toggle (enable or disable) the combat AI for the target. When combat AI is disabled, NPCs will have usual behaviour for anything that isn't combat-related. They will not be able to attack you (or do anything related to their combat AI).
togglecombatai Target Command
The above command will disable the combat AI for the targeted NPC (or enable it, if the combat AI was already disabled previously).