cybad4d4 should have made their comment an answer, i'd have upped it.
for me it is absolutely contextual. but the context does not exclude various factors that might implicate a given "class" of people as an adversary (or ally), without necessarily observing/experiencing the behavior of an individual. best example: cops and the like, who wear very visible uniforms that identify them as belonging to a "class" of people that have chosen an "occupation" that is inherently anti-liberatory and imposes on my own freedom. their uniform - and what it means to me - is part of the context.
if some group is known to hold a particular perspective or act in a particular way (eg, nazi skinheads, hippie freaks, business school grads, black bloc'ers, etc), it may well influence my assessment of any member of that group as adversary vs ally. if i have reason to associate an individual with such a group, i am likely to begin my assessment of them from a different starting point than an individual for which i have no basis of determining likely behavior.
for individuals that are not identifiable with some group or known pattern of behavior - who i will almost always be more likely to engage with - i will always try to make my assessment fully based on the context of my interaction with them, which may include any other reliable information i have about them. and obviously the information i have about them will grow with each interaction and depth of interaction, making my assessment of them as "friend or foe" easier and clearer over time.
my friend's friend is not necessarily my friend. my enemy's enemy is not necessarily my friend. my friend's enemy is not necessarily my enemy. all of these points simply highlight the fact that i will make my own determination about who i see as ally or adversary. and that determination is valid for exactly as long as.... i see it as valid.
as cybad4d4 said:
"Individual politicians and police are as capable of love as anyone else but whenever they attempt to assert authority over me they become my enemy."
fact is, that "whenever" is typically "pretty much always".