An example of the devil working on legalities can be found in many scripture verses. Here's one:
“Be angry, and don’t sin.” Don’t let the sun go down on your wrath and don’t give place to the devil. - Ephesians 4:26
The devil looks for footholds. If you become angry with someone and don't forgive that person, you're giving the devil a foothold in your life.