Archeological excavations have shown that a castle already existed there in the 12th century. After the first partition of Bavaria in 1255, the "Alte Hof" became the residence of Louis II, Duke of Bavaria in the then very northeastern part of the city. The castle was the first permanent imperial residence in the Holy Roman Empire under his son Louis IV, Holy Roman Emperor. The St. Lorenz Chapel at the north side, which was demolished later in the 19th century, once housed the regalia of the House of Wittelsbach.