The Castle of Agios Ioannis in the southwest coast of Astypalaia dates back to the Byzantine times. The construction of the castle coincides with the period of time when piracy was flourishing in the Aegean Sea. The construction of fortresses in locations that were far from the sea or up on hills, was a common measure of protection of the population from the raids of pirates and other enemies. The location of the castle of Agios Ioannis can confirm the aforementioned theory. It was built on the highest spot of the island, above the large homonymous beach which is only accessible by boat or on foot by following the mountain route.