If all soldiers are killed, the building burns down, and the enemy loses the territory controlled by that building. Defense of the player's military buildings is automatic; as enemies attack, any soldiers stationed in the building defend.
When the opposing forces are eliminated, the structure suffers damage, and the enemy relinquishes its claim on that area. The player's military buildings are inherently safeguarded; whenever enemies attack, the soldiers within the building spring into action to defend themselves.