Welcome to Heraklion Crete
In the centuries that followed Heraklion remained small and insignificant until 823 that Arabs Saracens in Abu Hafez, originating from Cordoba of today's Spain conquered Crete and destroyed until then the capital of the island Gortyn. then looking for a new coastal city to the capital, they chose Heraklion, which began fortifying the following year, 824, on the earlier Byzantine and Hellenistic walls and designated as the capital of the State, the Emirate name of Crete. They built a large fort, part of which still exists within the city, behind newer structures on sections of Chandakos routes, Daedalus and port , with a large perimeter trench. From that fortification trench, which stretched from sea to sea, the Saracens naming this city Rabdh-el-Khandak (= fortress moat), or simply ditch (Candia localized), making the base and their pirate activities.
But the continuous pirate activity Saracen those with Asia Minor pirates of Cilicia ravaged the islands and coasts of the Aegean and the Mediterranean in general, by having Candia (Heraklion) warehouse pirate booty and purchase center prisoners, especially women and children angered and frightened the Byzantine Empire. (Especially after the conquest and capture of Thessaloniki by the Arabs). Natural was the Byzantine policy to focus in the recapture of Crete. After a series of failed attempts, such as e.g. that of the turnip, the Constantinople decided to end the case of Crete. Reign Romanos II with paradynastefonta and parakoimomenos Joseph Bringas, awarded to Master and Nikiforos Fokas, the later Emperor, preparation and leadership of the campaign. 
Thus the Byzantines in July 960, landed in Heraklion Bay, 3 km west of the city, where after an eight-month siege, on March 6 of 961 attacked the city. The forces of Nikiforos Fokas, by making massacres sacked and burned the city ending in the Emirate of Crete. At first the capital of Crete was transferred to Fort Dikorfo hill near the current Prophet Elias, who became known as the Mosque. However, the new location does not serve the needs of a city, and so he began again facility on the ruins of the Arab city and Hellenize its name to Chandax.  Nikiforos Fokas arranged for the installation in Crete noble families of Constantinople for the upliftment of the morale of the Cretans and closer ties with the State of Vasilidas. This policy validates the Decree of Alexios II. Komninos (1182) which formally installed  in Crete  The noble (Leadership) Families, known "Twelve (12) Archontopoula" ie. The John Phocas (which during the Venetian rule the name evolved into Kallergi) Constantine Varoucha, Marino Skordylis, Leo Mousourou, Philip Gavala Andreas Melissenos, Thomas Archoleo (Archoleontos), Dimitrios Vlastos, Efstratios Hortatzis, Nikiforos Argyropoulos, Luke and Matthew Litinas Kafatos (Kalafatis). After this annexation Chandax remained the capital of Crete, home of the Governor General who brought the Byzantine title "Duke" and metropolitan seat. Around the same time built the church of St. Titus (first bishop of Crete) previously destroyed by the Saracens.