The citadel is located on a spot where already in Justinian times a fortress was erected. However, the present citadel owns its existence to the Seljuks, who took the city in 1071-1098. The oldest finds on the site date to the chalcolithic period (3700-3500 BC).
This is looking back towards the gateway. You can see the citadel hill is surrounded by a wall, then a moat.