There was a Benedictine abbey in Moosburg in the 8th century: a cluster of dwellings and artisans sprang up around it. Duke Heinrich der Löwe started the construction of the Kastulus Minster (cathedral) in 1171, dedicated to Saint Castulus – whose supposed relics were brought to the city. In the 12th century, a town was established and received its first charter in 1311. The walls and moat were completed in the 15th century. The town reached its peak during the early part of the 16th century. In 1599, the Benedictines moved to Landshut, reducing Moosburg's importance.