Hohenwerfen Castle (German: Burg Hohenwerfen) stands high above the Austrian town of Werfen in the Salzach valley, approximately 40 km (25 mi) south of Salzburg. The castle is surrounded by the Berchtesgaden Alps and the adjacent Tennengebirge mountain range. The fortification is a "sister" of Hohensalzburg Castle both dated from the 11th century. The former fortification was built between 1075 and 1078 during the Imperial Investiture Controversy by the order of Archbishop Gebhard of Salzburg as a strategic bulwark atop a 155 m (509 ft) high rock. Gebhard, an ally of Pope Gregory VII and antiking Rudolf of Rheinfelden, had three major castles extended to secure the Salzburg archbishopric against the forces of King Henry IV: Hohenwerfen, Hohensalzburg and Petersberg Castle at Friesach in Carinthia. Nevertheless Gebhard was expelled in 1077 and could not return to Salzburg until 1086, only to die at Hohenwerfen two years later.