The city was sold in 1451, and again in 1523, to the Habsburgs and continued under Austrian rule, with a brief occupation by Swedish forces under Carl Gustaf Wrangel during the 30 Years' War, until the 19th century. Bregenz was under Bavarian rule from 1805 to 1814. From 1842 to 1850, the harbour on Lake Constance was built, then enlarged in 1883 and from 1889 to 1891, and Austrian ship service was inaugurated in 1884. Railway services have existed since 1872, and since 1884 across the Arlberg massif.