The history of Albania emerged from the prehistoric stage from the 4th century BC, with early records of Illyria in Greco-Roman historiography. The modern territory of Albania has no counterpart in antiquity, comprising parts of the Roman provinces of Dalmatia and Macedonia. The territory remained under Roman control until the Slavic migrations of the 7th century, and was integrated into the Bulgarian Empire in the 9th century. The territorial nucleus of the Albanian state formed in the Middle Ages, as the Principality of Arbër and the Kingdom of Albania. The first records of the Albanian people as a distinct ethnicity also date to this period.
At the dawn of the establishment of the Ottoman Empire in Southeast Europe, the geopolitical landscape was marked by scattered kingdoms of small principalities. The Ottomans erected their garrisons throughout southern Albania by 1415 and established formal jurisdiction over most of Albania by 1431. Along with the Bosniaks, Muslim Albanians occupied an outstanding position in the empire, and were the main pillars of Ottoman policy in the Balkans.
Enjoying this privileged position in the empire, Muslim Albanians held various administrative positions, with over two dozen Grand Viziers of Albanian origin, such as Gen. Pasha, who commanded the Ottoman forces during the Ottoman-Persian Wars; Gen. Ahmed, who led the Ottoman army during the Austro-Turkish War (1663–1664); and, later, Muhammad Ali Pasha of Egypt. In the 15th century, when the Ottomans were gaining a firm foothold in the region, Albanian towns were organised into four principle sanjaks. The government fostered trade by settling a sizeable Jewish colony of refugees fleeing persecution in Spain.
Albanians could also be found throughout the empire, in Iraq, Egypt, Algeria and across the Maghreb as vital military and administrative retainers. This owed largely to their early use as part of the Devşirme system. The process of Islamization was an incremental one, commencing from the arrival of the Ottomans in the 14th century. Timar holders, the bedrock of early Ottoman control in Southeast Europe, were not necessarily converts to Islam, and occasionally rebelled; the most famous of these rebels is Skanderbeg. The most significant impact on the Albanians was the gradual Islamisation process of a large majority of the population, although such a process only became widespread in the 17th century. Mainly Catholics converted in the 17th century, while the Orthodox Albanians followed suit mainly in the following century. Initially confined to the main city centres of Elbasan and Shkoder, by this period the countryside was also embracing the new religion.