the castle of pau was founded in the middle ages