Burghausen is the largest town in the Altötting district of Upper Bavaria in Germany. It is situated on the Salzach river, near the border with Austria. Burghausen Castle rests along a ridgeline, and is the longest castle in the world (1,043 m). History The oldest mention of Burghausen is documented in the year 1025 as Imperial real property. Emperor Conrad II would later appoint the Counts of Burghausen as the financial administrators of the locality. But, as latest excavations have shown, the area around the main court of Burghausen's castle has at least been inhabited since the Bronze Age. With Archaeologists finding artifacts of the pre-metal Celtic, Iron Age, and Roman era, it is hard to pinpoint a "founding" date. The town has developed over thousands of years, but it is not yet possible to say how long there has been a permanent settlement. In 1164, Duke Henry the Lion took possession of the castle. The Wittelsbachs took possession of the castle in 1180 and the surrounding valley settlements in 1229. The conferral of town status was presumed at some point, but is not supported by sources. Starting in 1255, after the first division of Bavaria, Burghausen gained political and economic prominence as the second residence of the Lower Bavarian dukes. Burghausen's main source of income was the trade in salt from Hallein, (modern-day Austria). The salt was brought ashore in Burghausen and transported further overland. The landing spot was at the Mautner castle, which now houses the city's education and cultural centre. In 1307, the pre-existing local law was codified as municipal law, and in the first half of the 14th century, Emperor Louis IV granted the town further important privileges. By the end of the 14th century, Burghausen had become an administrative center as the site of the area's revenue office. Under the last three Lower Bavarian dukes, Henry XVI the Rich (1393–1450), Louis IX the Rich (1450–1479) and George the Rich, (1479–1503), Burghausen experienced an expansion and golden age as the second capital of the duchy Bavaria-Landshut. In 1505, after the Landshut War of Succession, Burghausen was one of the four Stewardships in reorganized Bavaria. The income from the salt trade was lost in 1594 because of the establishment of the ducal salt monopoly. Following this, Burghausen experienced more than 300 years of administrative and commercial decline: Heavy casualties and losses in the Thirty Years' War (1618–48),