The area of Lienz had been settled since the Bronze Age about 2000 BC. Celtic people lived here from about 300 BC on, mainly as miners, who came under control of the Roman Empire in 15 BC. The area was incorporated into the province of Noricum and Emperor Claudius had a municipium called Aguntum erected near Lienz in the today's municipality of Dölsach. Aguntum became the see of an Early Christian bishop in the 5th century but decayed during the Slavic settlement of the Eastern Alps and the subsequent fights with the Bavarii under King Tassilo I about 600. Part of the Slavic principality of Carantania, the area passed under Bavarian and finally Frankish suzerainty during the 8th century. Lienz itself was first mentioned as Luenzina in a deed issued by the Bishop of Brixen about 1030. The settlement itself, together with neighbouring Patriasdorf, then belonged of the Patriarchs of Aquileia, who were elevated to immediate landlords by Emperor Henry IV in 1077. It was then purchased by the scions of the Meinhardiner dynasty, who held the office of Aquileian Vögte (reeves) and chose Lienz as a residence. From about 1127 they called themselves Counts of Görz (Gorizia).
Located on the important trade route from Venzone in Friuli to Salzburg, the market town of Lienz received city rights on 25 February 1242. In 1278 the Counts finished Burg Bruck, a castle that until 1500 served as their local seat. When the Meinhardiner became extinct in 1500 upon the death of Count Leonhard of Gorizia, their estates were bequeathed to the Habsburg King Maximilian I and finally incorporated into the County of Tyrol. From the status of an Imperial residence, Lienz sank to the insignificance of a provincial town within the Habsburg Monarchy.
During the Italian campaigns of the French Revolutionary Wars, Lienz was occupied twice by French troops in 1797. After the Austrian defeat at the Battle of Austerlitz, Lienz with Tyrol passed to the Electorate of Bavaria according to