Hasankeyf is an ancient city, and has been identified with the Ilanṣura of the Mari Tablet (c. 1800 BC). The Romans had built the Cephe fortress on the site and the city became the Kiphas fortress and a bishopric under the Byzantine Empire. It was conquered by the Arabs, in ca. 640, renamed Hisn Kayf. In the 12th century, the city was successively captured by the Artukids as their capital. During this period, Hasankeyf's golden age, the Artukids and Ayyubids built the Old Tigris Bridge, the Small Palace and the Great Palace. The infrastructure, location and significance of the city helped increase trade and made Hasankeyf a staging post on the Silk Road. The Ayyubids (descendants of Saladin) captured the city in 1232 and built the mosques that made Hasankeyf an important Islamic center.
The city was captured and sacked by the Mongols in 1260. The city would rise from its ashes though as summer homes for Ak Koyunlu emirs were built. Following the Ottoman ascendancy established by Selim I in the region in the early 16th century, the city became part of the Ottoman Empire in 1515, during Sultan Süleyman I's campaign of Irakeyn (the two Iraqs, e.g. Arabian and Persian) in 1534, at the same time as Batman,Mosul, Baghdad and Basra.