Suppose I'm a letter carrier delivering mail on my New York City route, in uniform, with a clearly marked USPS mail truck, when some jerk driver almost hits me and I give a yell because they should watch where they're going. The car then stops and four guys get out, surround me, and take me away in their car. My mail truck is left in the middle of the street, unattended, where anybody can go in and take the mail out. Suppose further that while they're driving away, the driver turns around to taunt me and from this distraction rear-ends another car and the impact sends me forward; my shoulder and face hit parts of the seat in front of me. Then it becomes a hit-and-run. Suppose I'm beyond scared, but complying with most of their demands. They're yelling at me to stop resisting arrest, but I'm not resisting. They're not in uniform and their car isn't marked as a police car; they just claim to be police. I know that some criminals claim to be police so as to more easily kidnap their victims. They aren't always caught, especially not before irreparable damage is done.
One can still be charged with a crime for this, even when just trying to do one's job. I thought I had a right to defend myself even more strongly than what's demonstrated in this situation (though I know now that trying to defend oneself can easily result in one's own death).
Am I required to answer all questions and comply with all orders that anybody gives me? Am I allowed to defend myself against being taken away against my will and in violation of my duties? If the answer is "sometimes," how do I tell the difference between situations where it's yes and those where it's no?
EDIT (thanks to Dawn): This is similar to the highly-upvoted "How can you tell if you have to follow a police officer's instructions?" but for the case where it's not clear whether or not the person is actually a police officer, because they do not have a uniform or a marked car and just claim to be police. Is the claim sufficient?