Tossa de Mar is the site of one of Girona's most emblematic castles. Its construction originates in 1187 with the proclamation of Alfons el Cast that any person who fished close to the castle had to pay taxes to the monastery in Ripoll. Nowadays, it's the only example of a fortified medieval village that still exists on the Catalan coast. Built at the start of the 13th century with battlements for walls, it still has almost the entire original perimetre area. The wall includes four fortified towers and three cylindrical towers topped with machicolations (openings through which stones, hot oil or similar could be dropped onto attackers). The most famous towers are: the tower of Joanàs, which overlooks the town's bay; the tower of Hours, situated at the entrance to the weapons courtyard and which takes its name from the fact that it's the only place where there was a public clock; and the tower of Codolar, which is also known as the tower of Homage ('Homenatge') and looks over the beach of es Codolar. The Castle of Tossa de Mar was important thanks to the part it played as a defensive tower in the face of pirates from the north, helped by its privileged views over the surrounding area.