Under international law an occupying force has no right to defend themselves against the people they are occupying.
They do however have a responsibility to protect the people they’re occupying. The only people with the right of defence from any occupying force are those being occupied.