can you explian this please, if the sword was used for fighting for terrotory and not for Islam?

But when the forbidden months are past, then fight and slay the Pagans wherever ye find them, and seize them, beleaguer them, and lie in wait for them in every stratagem (of war); but if they repent, and establish regular prayers and practice regular charity, then open the way for them: for Allah is Oft-forgiving, Most Merciful (9:5).