Chania dates back to the Neolithic period where a settlement developed on the hill of Kastelli (roughly inside the green circle in the picture above). The first recorded fortifications were built around that hill during the Hellenistic period in the 3rd century BC.
The Byzantine wall was built in the 6th and 7th century AD on the foundations of the Hellenistic walls to protect the town from Arab raids. The walls were reinforced during the second Byzantine period in the 10th century in order to prevent a second Arab invasion, using available materials from Hellenistic and Greco-Roman buildings around the town. This interesting form of recycling can still be seen today if you look at the old walls, especially along the northern wall (in Sifaka Street)
Three centuries into the the Venetian occupation (1205-1669) the threat from the Ottoman Empire was growing and prompted the Venetians to build massive fortifications around the towns of Heraklion, Rethymnon and Chania. The buidling of the Chania fortress by the military architect Michele Sanmicheli began in 1538 and took around 20 years to complete. The fortifications were state-of-the art: the 6km of walls, surrounded by a 60m wide and 15m deep moat (still visible today on the western side of the walls where they are best preserved) were over 20 meters in height and angled at 20° from vertical in order to make cannonballs ricochet from the wall.
Six bastions reinforced the fortification walls and the wall had 3 main gates.
The Firkas (Turkish for "barracks") fortress was built in 1620 to protect the entrance of the harbour. If there was a threat of attack the harbour could be closed by a chain connecting the Firkas fortress to the base of the lighthouse. Cannons could also be positioned at very low level (see the arched openings at the base of the wall) in order to be able to fire at ships at water level.
The inside of the Firkas housed the barracks of the Venetian soldiers and contains storerooms and large underground cisterns.
In 1913 the Union of Crete with Greece was celebrated at Firkas Fortress. The Turkish flag was lowered for the last time and the blue-and-white Greek flag was raised in its place.