The answer certainly is ~not~ to teach them to condone and hang around kids that break the rules. We know about loyalty, but loyalty to friends is not the highest lesson from the point of view of the parent. The same kid will face many choices from 'friends' that they should learn to avoid.
Yeah, you guide them, and then you have to let them go, praying they will make the right choices. Nothing wrong with walking away.
How come you are up so late? :')