Swat has been inhabited for over two thousand years. The first occupants created well-planned towns. In 327 BC, Alexander the Great fought his way to Udegram and Barikot and stormed their battlements. In Greek accounts, these towns have been identified as Ora and Bazira, respectively. Around the 2nd century BC, the area was occupied by Buddhists, who were attracted by the peace and serenity of the land. There are many remains that testify to their skills as sculptors and architects.
In the beginning of the 8th century AD, the Gabari Swati Pashtun tribe advanced through Laghmanat, Nangarhar, and Dir. By the early 13th century, they captured Swat, defeating the local Buddhists and the Hindus. This war was headed by Sultan Pakhal Gabari and later on by the Jahangiri Sultan Behram Gabari rulers of Kunar Pech and cousins of the rulers of Kashmir.