There was a time when the residents of Lanzarote needed places of refuge and defence. Pirates and slavers would come ashore on their way to the Americas. The local peoples were unprepared and easy pickings.
Castles were constructed on the coast and inland. These were both used to defend against invaders and places of refuge.
Now these same castles have been turned into great places to visit. They have been made into water front restaurants and museums plus very interesting places to visit.