War of the Bavarian Succession
Following the War of the Bavarian Succession and the Treaty of Teschen in 1779 it had to be ceded to Austria. During the Napoleonic Wars it was once again restored to Bavaria after the 1809 Treaty of Schönbrunn, together with the adjacent Hausruckviertel, but finally attached to the Austrian Empire in 1815 according to the Final Act of the Vienna Congress.