In ancient times the region of Krujë was inhabited by the Illyrian tribe of the Albani, while the town is located near the Iron Age Illyrian site of Zgërdhesh.[5][6] Some scholars have identified the site with the main settlement of the Albani, Albanopolis, while others identified Albanopolis with Krujë itself.[6][7] During the Illyrian Wars the area of Krujë was captured by the Roman Republic.
Early medieval artifacts of Krujë include dress items and weaponry found in fifth- and sixth-century cemeteries, which display the high status and the wealth of the burials. Originally a middle-sized fortress like other urban centers, Krujë expanded to a town probably from the sixth to the ninth century AD.[8] In 1190 Krujë became the capital of the first Albanian state of the middle ages, the Principality of Arbër founded by Progon of the House of Progon.[9] During the reign of Gulam of Albania the principality was dissolved and incorporated in the newly founded Kingdom of Albania. During the late 13th and early 14th century the Byzantine and the Thopia family and in 1343[10] the Serbian Empire took control of the city. The Kingdom of Albania was eventually dissolved between 1363 and 1368, when Karl Topia captured its capital Durrës and incorporated its territories, including Krujë in 1363 in the Princedom of Albania.[11] After 1389 the House of Thopia gradually lost control of the town, which by 1395 had come under Ottoman vassalage. The Ottomans lost control of Krujë in the early 15th century, when it was captured by Niketa Thopia and regained it in 1415.[12] After its recapture it was incorporated in the Sanjak of Albania and formed an administrative unit with the status of Subaşilik as attested in the regional register of 1431.[12] During the Albanian Revolt of 1432-1436 the city was unsuccessfully besieged by Andrea Thopia.
Until 1432, the subaşi (governor) of Krujë had been Zagan Bey[citation needed], then Hizir Bey, and later during 1437—1438 Skanderbeg was its governor. In November 1438 Hizir Bey was again appointed as subaşi of Krujë until he was replaced in April 1440 by Umur Bey.[13] On 28 November 1443 Skanderbeg gained control over Krujë by deceiving its subaşi with forged sultan’s letter, and raised the first Albanian flag on the same day.[12] In 1444 Skanderbeg incorporated it in the League of Lezhë, the confederation of the Albanian principalities.
From 1450 until 1477 Krujë was defended successfully by the Albanian troops four times against the Ottoman army, which eventually captured it in 1478 during the fourth Siege of the city. During the first siege of Krujë in 1450, the 1,500 to 2,000 soldiers of the League of Lezhë under Vrana Konti and Skanderbeg defeated an Ottoman force of about 100,000 men led by Sultan Murad II, who had tried to bribe Konti to surrender the castle of the town. In the following decade Krujë was first besieged in 1466 and then in 1467 unsuccessfully by Ballaban Pasha and Sultan Mehmed II, whose total troops were about 150,000. After Skanderbeg’s death in 1468, the city’s garrison was supplemented by troops of the Republic of Venice. In 1476 the town was once more besieged by a ten-thousand-man army under Gedik Ahmed Pasha; however, the local garrison led by proveditor Pietro Vetturi fended off the Ottoman besiegers, who retreated after the arrival of reinforcements under Francesco Contarini and Nikollë Dukagjini. The city was eventually conquered by the Ottomans in 1478 after being besieged for over a year.[14] This success was viewed by the Ottomans as a good omen that the siege of Shkodra would also be successful.[15]