My question involves criminal law for the state of: New Mexico/Georgia/New York

I heard of a case in New Mexico where an unfortunate man was subjected to a "cavity search" by officers who suspected that he "hid something up his butt". Nothing was there. I have no idea why the police officers in this case actually WANTED to deal with such an examination with no evidence supporting it. If I were in their shoes, the LAST thing I'd want to do would be to "search" someone in this manner, and the mere thought disgusts me as it would most people. I read about this case from Business Insider. The man won a settlement case for this incident. I feel that the vast majority of police are not corrupt or abusing their power in any way, but if one were to be confronted with some sicko who tried to give a "lawful order" to search them in this manner........ I would not comply and would say that I want the "examination" to be done by a medical professional if they wished to perform such a "search". I'm a resident of Georgia at the moment, but I also spend time in NY. Anyways, this horrendous case had me wondering if refusing an order for this type of search that I heard in this case would lead to a charge of "resisting a lawful order" that could potentially stick. I am not anti-police, and I feel that most police are simply people doing a difficult and dangerous job and are worthy of great respect for doing so. However, if one of the bad apples were to attempt to do something as strange and disturbing as this....... could one be convicted for refusing an unlawful order such as this? I honestly think that most cops are doing their job and are protecting the people and doing a good job of it, but this case is utterly horrifying.