The castle and surrounding lands were given in 1111 to the huge Benedictine abbey of Melk (founded in 1089), which dominates the city. The abbey was enlarged and fortified in the 14th century, but most of its palatial buildings date from its Baroque reconstruction (1702–36)