it had the purpose of defending the coast from pirate attacks