From what I gather from this story, it sounds like the students were the dicks. They walked by a car, started looking inside it for no good reason, saw something they didn't like, and then wanted to act on something that had nothing to do with them or their school since this person was merely a visitor. I would say the first act of dickery falls on the students, not you. Being a third party to this event, unless your friend was unwilling to retaliate, then I'd say to a degree you had a right to react.
Since this sounds like a pretty rigid place, and a university setting, I would have thought there would be some sort of campus security. If they (the students) were creating a scene, it would have been far better to call security to stop them from surrounding his car and potentially causing damage. I'm not sure trying to torture them was the right thing to do, but you're entitled to do what you want as long as you didn't actually physically hurt anyone. Unless they are Amish, you'd think they would be more open-minded about other peoples' interest and lifestyles. Damn religious freaks anyway.