Tolmin (tɔlˈmiːn; Tolmino, German Tolmein) is a small town in northwestern Slovenia. It is the administrative centre of the Municipality of Tolmin. Tolmin stands on the southern rim of the Julian Alps and is the largest settlement in the Upper Soča Valley (Zgornje Posočje), close to the border with Italy. It is located on a terrace above the confluence of the Soča and Tolminka rivers, positioned beneath steep mountainous valleys. The old town gave its name to the entire Tolmin area (Tolminsko) as its economic, cultural and administrative centre. The area is located in the historic Goriška region, itself part of the larger Slovene Littoral, about north of Nova Gorica and west of the Slovene capital Ljubljana. In the north, the road leads further up the Soča River to Bovec, with an eastern branch-off to Škofja Loka and Idrija. Early inhabitants were Illyrians in Tolmin area. It was ruled successively by the Roman Empire, Odoacer, the Ostrogoths, the Eastern Roman Empire and part of the Lombard Duchy of Friuli until it was conquered by the Frankish king Charlemagne in 774 and replaced by the Carolingian March of Friuli. Ancestors of Slovenes had come to this area during the Slavic settlement of the Eastern Alps from about 600 onwards, embattled by Avar raids. It was passed to Middle Francia in 843 after the Treaty of Verdun and in 952 passed to the vast March of Verona, which was initially ruled by the Dukes of Bavaria, from 976 by the Carinthian dukes. King Henry IV of Germany ceded it to the newly established Patria del Friuli in 1077, before it was occupied by the Republic of Venice in 1420. Finally the Tolmin area was conquered by the Habsburg Emperor Maximilian I during the War of the League of Cambrai in 1509. Tolmin was then ruled with the possessions of the extinct Counts of Gorizia as part of the Inner Austrian territories of the Habsburg monarchy. In 1713 it was the centre of a peasant revolt against increased taxation and the local Count Coronini.