In 1402 Würzburg got a university. It later closed and then reopened in 1582. In 1631 Gustavus Adolphus of Sweden conquered Würzburg in the 30-year war. In 1803 the Duchy of Würzburg became part of Bavaria, in 1938 the city had more than 100,000 inhabitants for the first time. In 1945 the city was nearly completely destroyed.