While your troops sit in a foreign town it is occupied and its owner pays you 10% of everything they produce. Your troops live as long as the town is happy; when the last one dies the town is freed.
You are not occupying any towns.