 In 1180, with the trial of Henry the Lion, Otto I Wittelsbach became Duke of Bavaria and Munich was handed over to the bishop of Freising.Otto's heirs, the Wittelsbach dynasty would rule Bavaria until 1918.In 1240 Munich itself was transferred to Otto II Wittelsbach and in 1255, when the dukedom of Bavaria was split in two, Munich became the ducal residence of Upper Bavaria.