Complex sentence: At the time all the realm but Sweden proper was under foreign military occupation, an order formalized, albeit moderated in the subsequent Treaty of Nystad.
Split into simpler sentences: At the time, most of the Swedish Empire was under foreign military occupation, though Sweden itself was still free. This situation was later formalized, albeit moderated in the subsequent Treaty of Nystad.