I actually don't know why it matters for this discussion if it's legal or not.
It's going to happen period. Even if you are being wronged, at the time I'd relax, try to be calm, and immediately, (if your willing to get hassled) tell the officer you want your attorneys card out of your wallet because he needs to be notified. (this is excessive, and cops hate you for using your rights)
I have a shoulder injury, and kindly explained to the office who asked me to step out, that he was going to place me in cuffs that it was going to cause tremendous pain. He was nice enough not to cuff me while we chatted. He was very nervous young cop... I was annoyed but almost felt sorry for him.
P.S. Those cops in Ohio who forcibly took the clothes off that women? When I was in school, I remember in Columbus and Cleveland the DOJ I believe had setup a office because the area had so many dirty cops. The story was that a group of cops were into drugs, and would take hookers to abandon apartments rape them... Apparently one ended up dead... (don't know the whole story), But I do know walking across the street, as a normal white, (math geek looking) guy at 9pm at night in a safe neighborhood, got a gun pulled on me, and when I called to file a complaint, I immediately got harassed, and was told to come down in person, who was I, what business did I have filing a complaint... The usually coverup bullcrap...
I know it's might not feel high road, but I think honest IS high road. I deal with federal LE, crappy military contractor security and such, and I really, really don't enjoy them. There is so much corruption. I know there are a lot of honest cops out there, but anytime I've ever been pulled over in the last 5 years I nearly have a panic attack, and feel like a horrible person, for something I haven't even done wrong.
I'd say 90% of all my dealing with LE has been awful, however the other 10% was fantastic open, friendly officers..
Personally I'd say the midwest (aka Indiana, Ohio, Illinois) have some of the worst officers (sorry guys), but it seems like they are always trying to be more "bad ass" as if they need to catch up to big departments like the CHP. So far in California and New York city, I can't believe how nice the police officers have been compared to an awful experience in columbus, ohio, and indianapolis, indiana.