For me anarchism not about opposing a particular state (eg. your own state, some enemy state, etc) but about opposing every state and "the state" in general.
From this perspective there's always nuance when one "state attacks another". What are the states? What is their relationship? Why is there conflict? How does this affect me and the planet more generally?
And so someone's behavior could vary greatly depending on the situation. If you're living in nazi germany and your "country" is attacked, don't collaborate with the nazis. On the other hand if you're invaded by nazis, it's probably worthwhile to fight back - perhaps in the military or perhaps not. In many cases both states are terrible and it's a struggle to just survive their violence. I'm using nazis at the typical extreme example but most states are built on similar principles: fascism, xenophobia, patriarchy, colonialism/imperialism, etc. So many conflicts fit into this general framework.
TL;DR: It depends on the situation.