Complex sentence: It was the place for the local leader to live and as a defense when the city was under attacks.
Split into simpler sentences: It was the place for the local leader to live. It served also as a defense when the city was under attacks.