Making certain units unable to be attacked

Is there a way to stop the player or enemy from being able to attack a certain unit? (Not having the option to)

you can do that with AI for the enemy in vanilla FE but not sure about for players