In 1027, Emperor Conrad II, in order to secure the important route through the Brenner Pass, allotted the left bank of the Adige (from Lana to Mezzocorona) to the Duchy of Bavaria. During the 12th century, the local nobility went further: they built Tyrol Castle in the modern comune of Tirol in South Tyrol, near modern Merano; and around 1140, established the County of Tyrol as a state within the Holy Roman Empire.