tl;dr - Whether you're right or wrong, challenging being detained will likely turn out poorly; your recourse comes after you've been detained, not during.
It might turn out poorly, but even if you have "recourse [...] after you've been detained", you're put at a significant disadvantage for the rest of your life, just because of an arrest record.
See my post here -- https://news.ycombinator.com/item?id=8199524