I must have missed your comment before..
I believe that most palaces are originally built as fortresses or castles and converted later. This palace couldn't really have a protection role as it is accessible from the other side of the cliff easily, so that would not be difficult for enemies to approach.
My pleasure! This Thursday I will post about a castle from the same family, so you can compare them 🙂
Oh that is a good additional information, thank you. And I look forward to your next post.