In 1711, peace treaty of Szatmar allowed the Habsburgs take control of Hungary as long as Charles VI (the Holy Roman Emperor) maintained the borders of the Transylvanian and Hungarian estates. In 1772 they gained Galicia in the First Partition of Poland. In 1795 they gained additional land in Poland because of the Third Partition of Poland.