 Duke Wilhelm V commissioned the Jesuit Michaelskirche, which became a center for the counter-reformation, and also built the Hofbräuhaus for brewing brown beer in 1589.The Catholic League was founded in Munich in 1609.In 1623 during the Thirty Years' War Munich became electoral residence when Maximilian I, Duke of Bavaria was invested with the electoral dignity but in 1632 the city was occupied by Gustav II Adolph of Sweden.