Battles are calculated based on a rounds. One stack from the attacking army is pitted against one stack from the defending army. At the end of each round, one of the two stacks is completely routed. The remaining units of the winning stack continue to fight until they are completely routed or until they win the battle. At the end of the battle, whatever the result, each army gathers its disbanded units. Most of them will rejoin each army but a proportion of them will be definitively lost. So, even if an army is completely disbanded, it will only lose a part of its troops.