Heraklion is close to the ruins of the palace of Knossos, which in Minoan times was the largest centre of population on Crete. Though there is no archaeological evidence of it, Knossos may well have had a port at the site of Heraklion as long ago as 2000 BC.
The present city of Heraklion was founded in 824 by the Saracens who had been expelled from Al-Andalus by Emir Al-Hakam I and had taken over the island from the Eastern Roman Empire. They built a moat around the city for protection, and named the city, rabḍ al-ḫandaq ("Castle of the Moat"). The Saracens allowed the port to be used as a safe haven for pirates who operated against Imperial shipping and raided Imperial territory around the Aegean.
Restored Greek Era
In 961, Imperial forces under the command of Nikephoros Phokas, later to become Emperor, landed in Crete and attacked the city. After a prolonged siege, the city fell. The Saracen inhabitants were slaughtered, the city looted and burned to the ground. Soon rebuilt, the town of Chandax remained under Greek control for the next 243 years.
In 1204, the city was bought by the Republic of Venice as part of a complicated political deal which involved among other things, the Crusaders of the Fourth Crusade restoring the deposed Eastern Roman Emperor Isaac II Angelus to his throne. The Venetians improved on the ditch of the city by building enormous fortifications, most of which are still in place, including a giant wall, in places up to 40 m thick, with 7 bastions, and a fortress in the harbour. Chandax was renamed Candia and became the seat of the Duke of Candia, and the Venetian administrative district of Crete became known as "regno di Candia" (kingdom of Candia). The city retained the name of Candia for centuries and the same name was often used to refer to the whole island of Crete as well. To secure their rule, Venetians began in 1212 to settle families from