Škofja Loka lies at an elevation of 354 metres (1,161 ft) at the confluence of the Poljane Sora and the Selca Sora rivers, at the transition of the Sora Plain into the Škofja Loka Hills and the Polhov Gradec Hills. Its old centre stands on river terraces, and comprises Town Square (Plac) and Lower Square (Lontrg). On a plateau above the town stands Loka Castle, which houses the Loka Museum. Above the castle rises Krancelj Hill (475 metres or 1,558 feet). North of the town centre is Kamnitnik Hill (414 metres or 1,358 feet high), known for its conglomerate rock. Immediately south of the town is a plain known as Viršk or Viršk Plain (Slovene: Virško polje), which the Poljane Sora flows through before joining the Selca Sora. The name Viršk is a corruption of German Hirsacker 'millet field', named for the millet that was grown there in the past.
Škofja Loka was mentioned in 973 as Lonca (referring to Stara Loka) (and as Lonka in 1160, Lok in 1192–97, Scofolotti in 1293, and Scofioloco in 1295, among other names). The name literally means 'bishop's (wet) meadow', referring to its ownership by the Bishops of Freising.
In 973, the lordship of Škofja Loka was granted by Emperor Otto II to the Bishops of Freising, and for the next one thousand years the history of the town was tied to that of the distant ecclesiastical principality. A castle and tower were built above the town for defense purposes and later became the residence of the bishop's governor. In the 11th or 12th century. Emperor Otto III granted the bishops the right to mint coinage and collect tolls. Škofja Loka was first mentioned as having market rights in 1248, and having town rights in 1274.
Škofja Loka was walled in the 14th century. In 1457, Duke Jan Vitovec entered and burned the town. The town was attacked by the Ottomans in 1476. The town also suffered from plague and fires during this time. Peasant revolts occurred in Škofja Loka in 1488, 1492, and 1515. Škofja Loka was destroyed by the 1511 Idrija earthquake but soon rebuilt through the efforts of Bishop Phillip. Lutheranism was established in Škofja Loka in 1526. Laws were passed against the new religion, and a Counter-Reformation committee was convened at the castle in 1601, resulting in the burning of Protestant books.
Much of the town was damaged by fires in 1660 and 1698. The defensive walls gradually became obsolete and were mostly removed together with the town gates in 1789.
In 1803 the Prince-Bishopric of Freising was mediatised during the German Mediatisation and the enclave of Škofja Loka was annexed to the Austrian duchy of Carniola. Škofja Loka was the first town in Carniola to receive electric lights, even before the 1895 Ljubljana earthquake.
Škofja Loka was occupied by Italian forces on 13 April 1941. The Italian authorities were replaced by German authorities on 17 April. The first citizens of the town were arrested by the Gestapo on 6 May 1941 and in the following weeks 26 families were deported to Serbia. Partisan units were active in the area throughout the war. On 9 February 1944, German forces shot 50 hostages in revenge for the killing of a German soldier. The Partisans entered the town on 9 May 1945. After the war, Loka Castle was used to hold prisoners of war and political prisoners.
Škofja Loka is the site of seven known mass graves from the period immediately after the Second World War. Two additional mass graves connected with these are located in neighboring Vincarje. Additional prisoners of war were disposed of at Gabrovo, Bodovlje, Trnje, Pevno, and other sites. An unknown number of Home Guard prisoners of war and Slovene civilians, and possibly victims of other nationalities, were murdered and buried at several sites in and around Loka Castle.
The town assumed ownership of Loka Castle in 1959. Škofja Loka has one of the best-preserved medieval urban centres in Slovenia, and the town was proclaimed a cultural monument in 1987.
Škofja Loka is the birthplace of the Škofja Loka Passion Play (Latin: Processio locopolitana), the oldest play in Slovene. It was a penitentiary Passion procession in the form of a play, performed on Good Friday each year until 1751. The text in its current form was written around 1715 by the Capuchin Father Romuald (Lovrenc Marusič), based on an older tradition. It presents Jesus's suffering. In 1999, the play was revived with amateur actors. Two further reprises took place in 2000 and 2009, with more planned.
Since 1967, the Grohar Visual Art Colony has been held each year in Škofja Loka. Before 1991, both the Serbian town of Smederevska Palanka and the town of Škofja Loka held Grohar art colonies, run by an art teacher from an elementary school, Olga Milošević, in Smederevska Palanka. Now, after the collapse of Yugoslavia, the two are twin towns.
The Škofja Loka Capuchin monastery at Capuchin Square (Slovene: Kapucinski trg) in the old part of the town was built from 1707 until 1713. It keeps a library with about 30,000 books, among them about 5,200 of older date. The most prominent, in addition to the Škofja Loka Passion Play, are a copy of Jurij Dalmatin's Bible (the first translation of Bible to Slovene, 1584), the Dictionarium quatuor linguarum (the first multilingual dictionary of Slovene, 1592), two volumes of the Glory of the Duchy of Carniola (a detailed description of the central part of Slovenia and Istria; 1689), some 16th-century copies of Plato and Aristotle, and Aesop's fables, a compendium by Johann Zahn of mathematics and natural history from the end of the 17th century, titled Specula physico-mathematico-historica, and others. Tábor, Czech Republic
Smederevska Palanka, Serbia
In 2011 Škofja Loka became a member of the Douzelage, a unique town twinning association of 27 towns across the European Union. This active town twinning began in 1991 and there are regular events, such as a produce market from each of the other countries and festivals.Jan Oblak (born 1993), professional football player